Skip to main content

Sign in with VRChat Legends

Register an application in Developer tools. Register the exact callback URL your application uses.

Using an OpenID Connect library? Point it at https://api.vrchatlegends.com/.well-known/openid-configuration and request the openid scope. See OpenID Connect below.

  1. Send the user to GET /api/oauth2/authorize with client_id, redirect_uri, response_type=code, scope, and a random state bound to their session.
  2. Verify returned state before accepting the callback.
  3. Exchange the code at POST /api/oauth2/token using grant_type=authorization_code, code, redirect_uri, and client_id. Confidential clients authenticate with their secret. Public clients use PKCE S256 and send the original code_verifier.
  4. Request GET /api/oauth2/userinfo with the returned bearer token.

The identify scope covers identity and permitted public profile data. Request email only when your application needs it and the user consents. Never put client secrets in browser JavaScript.

Use POST /api/oauth2/revoke to revoke a token. Treat authorization codes as single-use credentials and handle expiry by restarting authorization.

Request fields​

EndpointFields
GET /api/oauth2/authorizeclient_id, exact redirect_uri, response_type=code, space-separated scope, and state
PKCE authorizationAlso send code_challenge and code_challenge_method=S256
POST /api/oauth2/tokengrant_type=authorization_code, code, redirect_uri, client_id, plus client authentication or code_verifier
GET /api/oauth2/userinfoAuthorization: Bearer ACCESS_TOKEN
POST /api/oauth2/token (refresh)grant_type=refresh_token, refresh_token, client_id, plus client authentication for confidential clients
POST /api/oauth2/revoketoken and application authentication. Public (PKCE) clients send client_id only
POST /api/oauth2/introspecttoken and application authentication
GET /api/oauth2/jwksNone. Public keys for verifying ID tokens

The token, revoke and introspect endpoints accept form or JSON bodies and support HTTP Basic client authentication. OAuth access tokens (vrclat_…) are for the OAuth endpoints; they are not interchangeable with personal API keys (vrcl_…) used for profile editing.

Check HTTP status and the returned error before storing credentials. A user may cancel consent. A callback without the expected state, with an error, or with a reused/expired code must not create a signed-in application session. Read expires_in from the token response rather than hardcoding a lifetime.

OpenID Connect​

Most sign-in libraries (Auth.js, Passport, oidc-client, Spring Security, and others) can set themselves up from one URL:

https://api.vrchatlegends.com/.well-known/openid-configuration

Add openid to the scopes you request. The token response then also contains an id_token: a JWT signed with RS256 that says who signed in. Verify it with the keys at GET /api/oauth2/jwks, and check that iss is https://api.vrchatlegends.com, aud is your client ID, and nonce matches the one you sent. ID tokens last one hour and are only proof of sign-in; keep using the access token for API calls.

ClaimNeeds scopeMeaning
subopenidThe user's stable VRChat Legends account ID
name, preferred_username, pictureidentify (or profile)Display name, username, avatar
email, email_verifiedemailEmail address, when the user consents

The userinfo endpoint (GET /api/oauth2/userinfo) can return more with these scopes:

ScopeAdds
statsLegend page views, likes and followers
socialsSocial links from the Legend page
friendsThe user's friends (people who follow each other)
minecraftThe linked Minecraft account

openid needs no setup in the application settings. profile is accepted as another name for identify.

Returning users​

A user who already approved the same permissions for your application is sent straight back to it, without seeing the consent screen again. They see the screen again when you ask for something new, when a group gate no longer passes, or when you send prompt=consent.

Send prompt=none to ask without showing anything. If the user is signed out or has not approved your application, they return to your redirect URI with error=login_required or error=consent_required.

When the user presses Cancel they return with error=access_denied, a readable error_description, and your state.

Refresh tokens​

Each refresh returns a new refresh token and retires the old one. Save the new one every time. Access tokens last 30 days and refresh tokens 90 days. Read expires_in rather than hardcoding either.

A retired refresh token that is used again more than ten seconds later is treated as stolen: every token from that sign-in is revoked and the user has to sign in again. A repeat within ten seconds (two requests racing each other) is refused with invalid_grant but revokes nothing. The same rule protects authorization codes. If you use webhooks, oauth.revoked tells you when this happens and why.

Errors​

Every error is JSON with a short error code and an error_description sentence that says what was wrong:

{ "error": "invalid_grant", "error_description": "The redirect_uri does not match the one used to start this sign-in." }

Your application's Recent problems tab in Developer tools lists the requests we refused in the last 14 days, each with the reason and a fix. Secrets, codes, tokens and user details are never stored there.

Changing the client secret​

Resetting the secret gives two choices. Keep it working for 24 hours is for a routine change: both secrets work while you deploy the new one, and nobody is signed out. Revoke everything now is for a leaked secret: the old secret and every token and code stop working at once.

Calling from a browser​

The token, userinfo, membership, revoke, discovery and key endpoints allow cross-origin requests, so a single-page app can use PKCE without its own server. Browser apps are public clients: use PKCE and never ship a client secret.