Search Posts

Category: asp.net-web-api2

SignalR web api Bearer token authorization using factory method in angularjs javascript

I am newbiee to SignalR. I am have created a factory method in angular js to invoke method on server side. app.factory(‘TranSteam’, [‘$rootScope’, ‘AuthenticationService’, function ($rootScope, AuthenticationService) { ‘use strict’; var accesstoken = AuthenticationService.getTokenInfo().accessToken; var conn = $.hubConnection(‘http://localhost:1400’); var transHubProxy = conn.createHubProxy(‘TransactionHub’); conn.qs = { ‘token’: accesstoken }; return { on: function (eventName, callback) { transHubProxy.on(eventName, function (trans) { var args = arguments; $rootScope.$apply(function () { callback.apply(transHubProxy, args); }); }); conn.start({ withCredentials: false }).done(function () […]