SSO Login (OAuth2) with Authentik and offline_access scope fails #662

Closed
opened 2025-11-20 05:15:35 -05:00 by saavagebueno · 2 comments
Owner

Originally created by @bbaumgartl on GitHub (Feb 27, 2024).

If the OAuth scope offline_access is used with the newest version of Authentik (new feature), the request returns the error consent_required.

I used Authentik 2024.2.1 and Netbird 0.26.0 configured as described here with added offline_access scope under Advanced protocol settings (since it is set in the Netbird configuration scopes list, see setup.env example).

Afterwards try to login and you get the error The Authorization Server requires End-User consent and the URL looks like this: /#callback?error=consent_required&error_description=The%20Authorization%20Server%20requires%20End-User%20consent

I had the same problem with a different client application and had to add the parameter &prompt=consent to the authorization request /application/o/authorize/?redirect_uri=... (see).

This seems to be the expected behaviour as stated in OpenID spec.

As far as i can tell this should be the corresponding line. If wanted i can create a pr and test it but i am unsure if it's the right place and what implications this change would have for other OAuth providers.

For now i have removed the offline_access scope from both the Authentik Provider and the setup.env.

Originally created by @bbaumgartl on GitHub (Feb 27, 2024). If the OAuth scope `offline_access` is used with the newest version of Authentik ([new feature](https://goauthentik.io/docs/providers/oauth2/#authorization_code)), the request returns the error `consent_required`. I used Authentik `2024.2.1` and Netbird `0.26.0` configured as described [here](https://docs.netbird.io/selfhosted/identity-providers#authentik) with added `offline_access` scope under `Advanced protocol settings` (since it is set in the Netbird configuration scopes list, see `setup.env` example). Afterwards try to login and you get the error `The Authorization Server requires End-User consent` and the URL looks like this: `/#callback?error=consent_required&error_description=The%20Authorization%20Server%20requires%20End-User%20consent` I had the same problem with a different client application and had to add the parameter `&prompt=consent` to the authorization request `/application/o/authorize/?redirect_uri=...` ([see](https://github.com/goauthentik/authentik/issues/8660#issuecomment-1965147392)). This seems to be the expected behaviour as stated in [OpenID spec](https://openid.net/specs/openid-connect-core-1_0.html#OfflineAccess). As far as i can tell [this](https://github.com/netbirdio/netbird/blob/main/client/internal/auth/pkce_flow.go#L96) should be the corresponding line. If wanted i can create a pr and test it but i am unsure if it's the right place and what implications this change would have for other OAuth providers. For now i have removed the `offline_access` scope from both the Authentik Provider and the `setup.env`.
saavagebueno added the triage-needed label 2025-11-20 05:15:35 -05:00
Author
Owner

@bbaumgartl commented on GitHub (Mar 4, 2024):

Maybe it was an Authentik issue: https://github.com/goauthentik/authentik/pull/6696

I'll test it once a new version is released.

@bbaumgartl commented on GitHub (Mar 4, 2024): Maybe it was an Authentik issue: https://github.com/goauthentik/authentik/pull/6696 I'll test it once a new version is released.
Author
Owner

@bbaumgartl commented on GitHub (Mar 5, 2024):

New version fixes it: https://docs.goauthentik.io/docs/releases/2024.2#fixed-in-202422

@bbaumgartl commented on GitHub (Mar 5, 2024): New version fixes it: https://docs.goauthentik.io/docs/releases/2024.2#fixed-in-202422
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#662