Giter Site home page Giter Site logo

Comments (11)

grumar avatar grumar commented on August 24, 2024 1

Fixed in d021fed, please let me now if everything works like expected.

from adal-angular5.

grumar avatar grumar commented on August 24, 2024 1

Fixed in #22 & #23

from adal-angular5.

geerzo avatar geerzo commented on August 24, 2024

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.

pandianramalingam avatar pandianramalingam commented on August 24, 2024

Hi @grumar ,

Set authorization header code throwing error if there are already headers present in the request.

BR,
PR

from adal-angular5.

geerzo avatar geerzo commented on August 24, 2024

Yes, the existing code has an error, this change fixes it.

from adal-angular5.

pandianramalingam avatar pandianramalingam commented on August 24, 2024

when we can expect updated version ?

from adal-angular5.

grumar avatar grumar commented on August 24, 2024

@geerzo @pandianramalingam
I made some changes in d021fed few days ago. Did You try lastest version?

from adal-angular5.

geerzo avatar geerzo commented on August 24, 2024

@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.

jo-me avatar jo-me commented on August 24, 2024

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.

stamler avatar stamler commented on August 24, 2024

@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.

grumar avatar grumar commented on August 24, 2024

published as beta
npm install [email protected]

from adal-angular5.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.