[GH-ISSUE #1635] SSO Login (OAuth2) with Authentik and offline_access scope fails #2698

Open
opened 2026-08-05 00:48:30 -04:00 by saavagebueno · 0 comments
Owner

Originally created by @bbaumgartl on GitHub (Feb 27, 2024).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/1635

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). Original GitHub issue: https://github.com/netbirdio/netbird/issues/1635 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 2026-08-05 00:48:30 -04:00
Sign in to join this conversation.
No Label triage-needed
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#2698