Azure app registration and Gitea OAuth2 - "issuer" property of .well-known/openid-configuration doesn't work for "common" or "organizations", but works for "consumers"

Claire 1 Reputation point
2020-06-21T21:00:17.137+00:00

My server setup: Gitea 1.11.6 running on Arch Linux. I'm using Microsoft's OAuth2 service as an authentication provider. If I use the common endpoint, Gitea throws a 500 error and logs the following:

routers/user/auth.go:601:handleOAuth2SignIn() [E] UserSignIn: oauth2: error validating JWT token: issuer in token does not match issuer in OpenIDConfig discovery

If I use the consumers endpoint, everything immediately works as expected, and Gitea allows me to create an account (or link an existing one) with my Microsoft account as the authentication provider.

I noticed in the actual openid-configuration response from Microsoft, the "common" and "organizations" endpoints both have "{tenant}" in the string value for "issuer", whereas "consumers" returns a GUID.

common

"issuer": "https://login.microsoftonline.com/{tenantid}/v2.0",

consumers

"issuer": "https://login.microsoftonline.com/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0",

It seems like maybe something's wrong with the "issuer" property in the common endpoint response. I'm not sure why else Gitea would be throwing a token issuer mismatch error.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,226 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.