Someone reached out to me recently to ask whether Wikimedia could make its public keys used for OAuth 2 access tokens public. This would allow external apps to verify that an access token is legitimate, and which user it belongs to.
The OAuth 2 spec doesn't say anything about the access token (other than "usually opaque to the client"), but AIUI using a signed but publicly readable access token is not uncommon. ChatGPT says (although I haven't verified it) "Google Cloud, AWS Cognito, Microsoft Entra ID, Auth0, Keycloak, etc., all issue RS256-signed JWT access tokens".
Our OAuth 2 access tokens are HS256 encrypted JWTs with content like this:
[ "aud" => [ "14a4471ca53fa4c10d05292e14eae9e6", // OAuth app ID ], "jti" => "...", // nonce "iat" => "2025-06-26 13:11:50.196838 +00:00", // time issued "nbf" => "2025-06-26 13:11:50.196841 +00:00", // start of validity "exp" => "3025-06-26 13:11:50.193600 +00:00", // expiry "sub" => "29601819", // central ID "iss" => "https://meta.wikimedia.org", // issuer "ratelimit" => [ "requests_per_unit" => 5000, "unit" => "HOUR", ], "scopes" => [ "basic", "createeditmovepage", "editprotected", ], ]
As of today, most of the information in the access token is public anyway. I am not sure about the ratelimit - maybe that can be used to identify Wikimedia Enterprise contract tiers? But then the client would know that anyway.
The access token can be exchanged at the OIDC UserInfo endpoint for a plain, unencrypted JSON which shows more information about the user, so making the access token's content public isn't strictly necessary for any client, but might make things simpler.