API reference
My Auths is a standard OpenID Connect provider. Every endpoint is under the issuer, https://api.myauths.com, and listed in its discovery document.
| Endpoint | Method | Client authentication |
|---|---|---|
/.well-known/openid-configuration | GET | None |
/oauth2/authorize | GET (browser) | None |
/oauth2/token | POST | HTTP Basic |
/oauth2/jwks | GET | None |
/userinfo | GET | Access token |
/oauth2/revoke | POST | HTTP Basic |
/oauth2/introspect | POST | HTTP Basic |
/connect/logout | GET (browser) | None |
What applications can use
The discovery document describes the whole server. Applications registered in the dashboard use this part of it:
| Supported | |
|---|---|
| Response type | code |
| Grant types | authorization_code, refresh_token |
| PKCE | Required, S256 |
| Scopes | openid, profile, email |
| Client authentication | client_secret_basic |
| Token signing | RS256 |
Discovery
curl https://api.myauths.com/.well-known/openid-configuration
Returns the issuer and every endpoint URL. Most libraries only need the issuer and read the rest from here.
Authorization
GET /oauth2/authorize, opened in the user's browser. Starts a sign-in and ends with a redirect to your redirect_uri.
| Parameter | |
|---|---|
response_type | Required. code. |
client_id | Required. |
redirect_uri | Required. Exactly one of the application's redirect URLs. |
scope | Required. Space-separated, including openid. |
code_challenge | Required. Base64url SHA-256 of the code verifier. |
code_challenge_method | Required. S256. |
state | Recommended. Returned unchanged. |
nonce | Recommended. Copied into the ID token. |
Success: redirect_uri?code=...&state=.... Failure: redirect_uri?error=...&error_description=...&state=.... See Handle the callback.
Token
POST /oauth2/token, from your server, form-encoded, with the client ID and secret as HTTP Basic credentials.
Exchange a code:
| Parameter | |
|---|---|
grant_type | authorization_code |
code | The code from the callback. Single use, valid 5 minutes. |
redirect_uri | The same value as in the authorization request. |
code_verifier | The PKCE verifier. |
Refresh:
| Parameter | |
|---|---|
grant_type | refresh_token |
refresh_token | The latest refresh token. Single use. |
scope | Optional. A subset of the granted scopes. |
Both return access_token, refresh_token, id_token, token_type (Bearer), expires_in (seconds) and scope.
JWKS
GET /oauth2/jwks returns the public keys that verify access and ID tokens. Cache it, and fetch it again when a token has an unknown kid. See Verifying access tokens.
UserInfo
GET /userinfo with Authorization: Bearer ACCESS_TOKEN. Returns sub, plus name and picture with the profile scope and email and email_verified with the email scope. The access token must include the openid scope.
Revocation
POST /oauth2/revoke, HTTP Basic, form-encoded:
| Parameter | |
|---|---|
token | The token to revoke, usually the refresh token. |
token_type_hint | Optional. refresh_token or access_token. |
Answers 200 whether or not the token was valid.
Introspection
POST /oauth2/introspect, HTTP Basic, form-encoded, with token (and optionally token_type_hint). Answers {"active": false} for an invalid, expired or revoked token, otherwise "active": true with its claims.
End session
GET /connect/logout, opened in the user's browser. Ends the user's My Auths session.
| Parameter | |
|---|---|
id_token_hint | Required. The latest ID token your app received for the user. |
post_logout_redirect_uri | Optional. One of the application's sign-out redirect URLs. |
state | Optional. Added to the redirect. |
Errors
The token, revocation and introspection endpoints answer errors as JSON, for example {"error": "invalid_grant"}, with status 400 (or 401 for invalid_client).
error | Meaning |
|---|---|
invalid_client | Wrong client ID or secret, the wrong authentication method (use HTTP Basic), or the application is disabled. |
invalid_grant | The code or refresh token is invalid, expired or already used, the PKCE verifier doesn't match, or the user can't use the application any more (suspended, removed from an invite-only application, or account disabled). |
invalid_request | A required parameter is missing or repeated. |
invalid_scope | A scope other than openid, profile and email, or more than was granted. |
unauthorized_client | A grant type other than authorization_code and refresh_token. |
access_denied | Authorization only: the user declined, or isn't allowed to use the application. |