Sending authorization header along with a Restangular call - Not global??
See original GitHub issueHi there,
I have implemented 2 Restangular services, 1 is the pure Restangular that i will use to send across my token and the other is what I have called AuthRestangular where I need to build the Authorization header.
I did get it to work… using the following but I think this is changing it on a global scale, which i believe is going to affect my standard Restangular injected variable.
var encoded = base64.encode('userb:userb');
$http.defaults.headers.common.Authorization = 'Basic ' + encoded;
I did try the following new method but I think i am calling it wrong…
AuthRestangular.setDefaultHeaders({'Authorization': 'Basic ' + encoded });
It doesn’t give me an error but it doesn’t seem to be sending the header across, my rest service never detects it.
Any ideas ? I can’t seem to find any examples.
Thanks
Issue Analytics
- State:
- Created 10 years ago
- Comments:26 (7 by maintainers)
Top Results From Across the Web
Angular - Bearer token not sent in request header on API calls
For user Authentication the application requests and receives a bearer token from Azure AD. It should then transmit this token with each REST ......
Read more >Using Access Token to Secure Angular Calls to Web API
Let's learn how to extract Access Token from the user object and use it inside the Angular request to access prtected API resources....
Read more >ng2-restangular-fix-queryparams - npm
I need to send Authorization token in EVERY Restangular request, how can I do this? I need to send one header in EVERY...
Read more >Posting, Deleting, and Putting Data in Angular | Pluralsight
An HTTP request is a packet of information which is transferred from source to destination and termed as Client-Server respectively.
Read more >Cloud API reference | Reference Documentation - Particle docs
To send a custom header using curl, use you the -H flag. The access token is called a "Bearer" token and goes in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The RestangularProvider.setDefaultHeaders will work for requests made via Restangular only. While $http.defaults.headers.common will work on all requests made via $http including Restangular requests, because Restangular also use $http behind the scene.
No solution yet?