mozilla / mozilla-django-oidc

A django OpenID Connect library
https://mozilla-django-oidc.readthedocs.io
Mozilla Public License 2.0
452 stars 169 forks source link

ID-token vs userinfo endpoint #479

Closed pandawankenobi closed 12 months ago

pandawankenobi commented 1 year ago

In the documentation (https://mozilla-django-oidc.readthedocs.io/en/stable/installation.html#add-settings-to-settings-py) instructions are to add this to settings: OIDC_OP_USER_ENDPOINT = "<URL of the OIDC OP userinfo endpoint>" However my OP does not provide such an endpoint in it's well known config. When asked they refer to the instructions here: https://learn.microsoft.com/en-us/azure/active-directory/develop/userinfo#consider-using-an-id-token-instead where instructions are to use a token instead of an endpoint. Is there a way to do this?

tonial commented 1 year ago

Hi,

I think you just have to subclass OIDCAuthenticationBackend and override get_userinfo() to use the data from the id_token to do that. You can see how to subclass the backend here : https://mozilla-django-oidc.readthedocs.io/en/stable/installation.html#connecting-oidc-user-identities-to-django-users

akatsoulas commented 12 months ago

I am closing this per the last comment. Please re-open if the answer does not address the issue.