-
-
Notifications
You must be signed in to change notification settings - Fork 545
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
Azure B2C v2 authentication via generic OIDC back-end produces "KeyError 'access_token'" on application's redirect page #699
Comments
Any comment on this? |
@nijel as far as I understand it, this is a bug with the OIDC back-end in general, since, as described above, there seems to be something wrong with parsing the response. Can you reproduce the problem I've described above? Have you looked into it? Now, in my particular use case, I chose the vanilla OIDC back-end over the B2C-Tenant back-end, because, within my cloud environment, that was just easier than fiddling with Docker compose files, volumes and Weblate's |
Sorry, I currently have no clue whether it's bug in the generic backend or something specific to Azure. Using service specific backend is always recommend when it exists |
Okay, I will look into the Azure specific back-end again. However, I still think something might be wrong with the Weblate response parser. After all, I would expect Microsoft to implement the OIDC standard on their identity systems correctly. Are there any plans to investigate this? Maybe @omab who created Please let me know if I can provide any further information that could be useful. |
I proposed PR 777 that may help in the adoption of the B2C provider since it supports the updated endpoints. You can also achieve a similar result by setting the following values:
That seemed to work in some initial testing but probably isn't the greatest solution long term. |
Coming from WeblateOrg/weblate#7911
Expected behaviour
After successful login and redirect to the application's specified redirect uri, I expect to be logged in without any error message.
Actual behaviour
I am using Azure B2C for Weblate authentication via OpenID Connect. I've set the environment variable
WEBLATE_SOCIAL_AUTH_OIDC_OIDC_ENDPOINT
to the valuehttps://my-company-auth.b2clogin.com/my-company-auth.onmicrosoft.com/B2C_SIGNUP_SIGNIN/v2.0
.When I click on the Oidc button on the Weblate login page
https://weblate.mycompany.com/accounts/login/
, I am redirected to Azure B2C and I see the correct policy login page. I can also log in successfully and I am redirected tohttps://weblate.mycompany.com/accounts/complete/oidc/
.But then I see the following Django error message:
What are the steps to reproduce this issue?
Input clear steps to reproduce the issue for a maintainer.
https://weblate.mycompany.com/accounts/login/
and click on the button "Oidc".https://weblate.mycompany.com/accounts/complete/oidc/
is loaded.Any logs, error output, etc?
See above
Any other comments?
According to the error message, the problem seems to be here:
social-core/social_core/backends/open_id_connect.py
Line 234 in 3d818d6
and the code expects to find the field
access_token
in the http response from the Azure B2C OIDC.If that helps, the response from
https://mycompanyauth.b2clogin.com/mycompanyauth.onmicrosoft.com/B2C_SIGNUP_SIGNIN/v2.0/.well-known/openid-configuration
looks like this:Further browser debugging shows, that Weblate issued a request to
https://login.microsoftonline.com/0eca7f40-e581-4860-a149-172d3a66a43b/oauth2/v2.0/authorize?client_id=e60c2871-629b-4c40-8dd2-a8418ab7ce8d&redirect_uri=https://mycompanyauth.b2clogin.com/mycompanyauth.onmicrosoft.com/oauth2/authresp&response_type=code&scope=openid+profile&response_mode=form_post&nonce=g78JTkGi8YBTeaGbHjgNlg==&state=StateProperties=eyJTSUQiOiJ4LW1zLWNwaW0tcmM6NWQ5YTNkZmQtZDkwZC00MGJlLTkxYWUtYjdjZmFhMjZjYzc0IiwiVElEIjoiZGJhNTFmODAtZGM5Yi00MzVjLTg2ZTctZDQ5NTQ3MjBkNTFmIiwiVE9JRCI6IjMyNzU0ZTBmLTc1ZWYtNDY1NC05ZWFlLTc3OWIwMGI4M2M1NSJ9
Note the request query parameter
response_type
which is set tocode
. So the response probably should not not have a fieldaccess_token
anyway, as far as my basic OIDC / OAuth knowledge goes.@nijel mentioned #459, but I don't think this is related, because, as explained above, this seems to be a parsing bug on the Social-Auth-Core client side and not an endpoint error on the Microsoft server side.
The text was updated successfully, but these errors were encountered: