Comments (11)
Fixed in d021fed, please let me now if everything works like expected.
from adal-angular5.
from adal-angular5.
This works for me. I would change
options.headers = options.headers.append('Authorization', 'Bearer ' + token);
to
options.headers = options.headers.set('Authorization', 'Bearer ' + token);
This will ensure that if someone set that field already it's overwritten. Otherwise you wind up with 2 Authorization headers.
from adal-angular5.
Hi @grumar ,
Set authorization header code throwing error if there are already headers present in the request.
BR,
PR
from adal-angular5.
Yes, the existing code has an error, this change fixes it.
from adal-angular5.
when we can expect updated version ?
from adal-angular5.
@geerzo @pandianramalingam
I made some changes in d021fed few days ago. Did You try lastest version?
from adal-angular5.
@grumar yes I have and it doesnโt work if the headers is already set because the local headers variable never gets set. You if block checks if options.headers is null then sets the headers variable but if that check fails the headers variable is never set but the next line sets the Authorization header and it fails because headers is null.
from adal-angular5.
The original issue is resolved. THanks for that!
For more fault tolerance, I'd check if the options parameter is actually set because otherwise the request will fail altogether. If no special http options are needed the parameter could be omitted.
from adal-angular5.
@jo-me Making observe: optional in the options object and using the HttpObserve type (like HttpClient does) should solve the problem. I did it but haven't tested it yet. May be a nice update to @grumar 's code.
from adal-angular5.
published as beta
npm install [email protected]
from adal-angular5.
Related Issues (20)
- Write unit tests: HOT 1
- use @typings for adal-angular HOT 3
- cherry pick [benbran#23](https://github.com/benbaran/adal-angular4/pull/23) HOT 1
- BUG: Cannot call Microsoft Graph using adal-angular5 HOT 1
- Use version 2.1.1 HOT 1
- handleWindowCallback refreshing page HOT 1
- Fancy doing an angular6 one? HOT 1
- No way to handle interaction_required adal errors
- Post Angular 6 and rxjs Upgrade throws runtime error. HOT 8
- Access token Expiry - 401 Unauthorized on AJAX HOT 2
- Authorization to WEB API HOT 6
- [Bug] Acquire token ( Refresh token ) not working
- Error when first time acquire access token for resource HOT 3
- Http Interceptor does not account for resource specific tokens HOT 1
- how to update new token when generated token has expired
- Token is null & authenication is false
- ng-init calling 2 times big issue
- Multi Issue in aquiretoken function. The function works fine if the token is in local storage. But when you will remove the storage and invoke the acquiretoken function it will not get inside the subscribe block. and more over that its getting invoked only once
- Multiple issues in Version 2.1.1 HOT 1
- Does adal-angular 5 supports in angular 7? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adal-angular5.