Keycloak-angular: Support changing Authorization Http Header name

Created on 3 May 2018  路  5Comments  路  Source: mauriciovigolo/keycloak-angular

Hi,
In our organization the token is expected to be in a different header than the standard 'Authorization'. Having support for changing the Http Header name as well would be helpful (similar to #45 ).

I have implemented this already and can submit the PR for consideration if this feature request is acceptable

Thanks

Enhancement

Most helpful comment

@mauriciovigolo, yes Authorization is the standard for Http. Unfortunately the services our SPA needs to call use a different header for authentication.
The suggested change is to default to Authorization but have the option to change it.

Requests to Keycloak would continue to use the default Authorization header as it is hard coded in keycloak.js

Happy to contribute, thanks for the great project!

All 5 comments

@osafi, first of all, thanks for contributing to the project!

I have a question about this feature: isn't the Authorization header a default value for Http and for keycloak?

@mauriciovigolo, yes Authorization is the standard for Http. Unfortunately the services our SPA needs to call use a different header for authentication.
The suggested change is to default to Authorization but have the option to change it.

Requests to Keycloak would continue to use the default Authorization header as it is hard coded in keycloak.js

Happy to contribute, thanks for the great project!

@osafi, this feature certainly may help others with the same situation you are facing.

Thanks for PR #54! Great to have your contribution!

PS: This will be shipped on release 6.0.0, okay?

Hi @mauriciovigolo,
So I used your Angular repo, and integrated with my application, and now i see there is a key called Authorization in my request header, but however my api accepts access_token as key and value of access_token, how can i change my request header key? Please help

Hi @mauriciovigolo ,
there is only a declared class of KeyCloak in service file, if I change my header name in keycloak.js then when I push my code on someother environment, this will cause a problem.

Was this page helpful?
0 / 5 - 0 ratings