-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Authentication via Oauth2 auth-provider using Basic Authorization is not working #8082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hm. The constructor for the strategy here seems to be able to accept a |
OAuth 2.0 is unfortunately not a strict enough standard to have things work out of the box in a lot of situations. Is it a well known OAuth provider that you're using @sonali-mishra-94? Perhaps there's a more specific passport provider that we can add instead. |
Thanks @Rugvip for taking a look at this! I think what @freben has suggested can be tried. I am sure a lot of others might be having the same problem given how many providers make use of auth headers... |
@sonali-mishra-94 Would you be able to try making a change to the existing Backstage strategy for this, to supply such a header? It would be valuable to be able to see that the end result works for your particular installation. In such a pull request, we might discuss further how this behavior should be enabled. For example, whether there should be some config parameter that turns it on, or if it should be done through a header generator callback given to the factory for the strategy, or something else. |
Raised the following PR to supply custom authorization header: |
Closing since the PR is merged. |
Thanks alot for helping me with my first contribution to Backstage ! |
Uh oh!
There was an error while loading. Please reload this page.
While using Backstage's battery-included generic oauth2-auth-provider, the authentication fails to complete when using an authentication provider that expects clientId and clientSecret to be passed in Authorization header.
Expected Behavior
Successful authentication via all auth-providers that are based on oauth2.0
Current Behavior
Authentication is failing with the following error:
Authentication Failed, failed to obtain access token : authorization header required
Backstage is using passport-oauth2 strategy which is in turn using node-oauth's getOAuthAccessToken function
This function is making a post request to configured oauth-provider's token endpoint by setting clientId and clientSecret as request params.
(Refer: https://github.com/jaredhanson/passport-oauth2/blob/ee3fe9f17c0f3a90f2d9d938f267e9942b9fba49/lib/strategy.js#L130)
However, the expected method of authentication via most auth-providers is by using client id and secret in Authorization header as follows:
Authorization: Basic b64encodedclientId:clientSecret
This is the reason why authentication fails with the error message of missing authorization header.
However, node-oauth lib is no longer being maintained.
Possible Solution
Steps to Reproduce
Context
To configure authentication via in-house generic oauth2 auth-provider using Backstage.
Existing issues with node-oauth and passport
ciaranj/node-oauth#300
jaredhanson/passport-oauth2#75
The text was updated successfully, but these errors were encountered: