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.
- Send the user to
GET /api/oauth2/authorizewithclient_id,redirect_uri,response_type=code,scope, and a randomstatebound to their session. - Verify returned
statebefore accepting the callback. - Exchange the code at
POST /api/oauth2/tokenusinggrant_type=authorization_code,code,redirect_uri, andclient_id. Confidential clients authenticate with their secret. Public clients use PKCE S256 and send the originalcode_verifier. - Request
GET /api/oauth2/userinfowith 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
| Endpoint | Fields |
|---|---|
GET /api/oauth2/authorize | client_id, exact redirect_uri, response_type=code, space-separated scope, and state |
| PKCE authorization | Also send code_challenge and code_challenge_method=S256 |
POST /api/oauth2/token | grant_type=authorization_code, code, redirect_uri, client_id, plus client authentication or code_verifier |
GET /api/oauth2/userinfo | Authorization: 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/revoke | token and application authentication. Public (PKCE) clients send client_id only |
POST /api/oauth2/introspect | token and application authentication |
GET /api/oauth2/jwks | None. 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.
| Claim | Needs scope | Meaning |
|---|---|---|
sub | openid | The user's stable VRChat Legends account ID |
name, preferred_username, picture | identify (or profile) | Display name, username, avatar |
email, email_verified | email | Email address, when the user consents |
The userinfo endpoint (GET /api/oauth2/userinfo) can return more with these scopes:
| Scope | Adds |
|---|---|
stats | Legend page views, likes and followers |
socials | Social links from the Legend page |
friends | The user's friends (people who follow each other) |
minecraft | The 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.