balderdashy/angularSails

Setting header config not working

Opened this issue · 2 comments

Not able so set the Auth header when my user logs in and has a valid auth token based on the documentation

$sails.defaults.headers.common.Authorization = 'Basic '+idToken;

.controller('LoginCtrl', function($scope, auth, $state, store, $sails) {
auth.signin({
//some code here
}, function(profile, idToken, accessToken, state, refreshToken) {
//some code here

//Make sure that the socket server has Authorization Header Set
$sails.defaults.headers.common.Authorization = 'Basic '+idToken;

$state.go('home');

}, function(error) {
console.log("There was an error logging in", error);
});
})

I am also having issues setting headers. I am setting them as per the docs, but in my controller action I can not see the headers (req.headers). Do I need to enable anything on the server for these to show up?

After stepping through the code, the headers are never sent from the connection function to the socket method.

Possible solution: #38