oauth2-proxy: Azure provider fails when scope is not Microsoft Graph
My AAD application is configured for the following API permissions:
to be able to authenticate against Azure Kubernetes.
The proxy is configured like follows:
provider: azure
oidc-issuer-url: https://login.microsoftonline.com/[REDACTED]/v2.0
scope: 6dae42f8-4368-4678-94ff-3960e28e3630/.default
and I get the error:
The scope 6dae42f8-4368-4678-94ff-3960e28e3630/.default https://graph.microsoft.com/.default is not valid. static scope limit exceeded.
because the proxy adds the scope https://graph.microsoft.com/.default, but in my case I don’t need Microsoft Graph.
If I try to use provider: oidc instead, I get the error Error redeeming code during OAuth2 callback: token response did not contain an id_token.
One possible solution would be to allow passing custom scopes without adding https://graph.microsoft.com/.default.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (7 by maintainers)
I had a similar problem with the
oidcprovider logging in to Azure, in my case I tracked it down to the fact that the proxy was unable to fetch the groups from the userinfo endpoint without the Microsoft Graph scope. In my case I don’t actually care about group membership (I’m only using OIDC for authentication, I handle authorization directly in my own app) so I ended up with the following workaround (sorry, I use alpha config, and andenvsubst-type transformation on my config file to insert the right values for the@FOO@placeholders):essentially, skip discovery and instead configure the login, redeem and jwks URLs by hand. If no profile URL is set then it will just use the ID token groups (if any) and not try to enrich the list by calling out to the userinfo endpoint.