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.

EndpointMethodClient authentication
/.well-known/openid-configurationGETNone
/oauth2/authorizeGET (browser)None
/oauth2/tokenPOSTHTTP Basic
/oauth2/jwksGETNone
/userinfoGETAccess token
/oauth2/revokePOSTHTTP Basic
/oauth2/introspectPOSTHTTP Basic
/connect/logoutGET (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 typecode
Grant typesauthorization_code, refresh_token
PKCERequired, S256
Scopesopenid, profile, email
Client authenticationclient_secret_basic
Token signingRS256

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_typeRequired. code.
client_idRequired.
redirect_uriRequired. Exactly one of the application's redirect URLs.
scopeRequired. Space-separated, including openid.
code_challengeRequired. Base64url SHA-256 of the code verifier.
code_challenge_methodRequired. S256.
stateRecommended. Returned unchanged.
nonceRecommended. 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_typeauthorization_code
codeThe code from the callback. Single use, valid 5 minutes.
redirect_uriThe same value as in the authorization request.
code_verifierThe PKCE verifier.

Refresh:

Parameter
grant_typerefresh_token
refresh_tokenThe latest refresh token. Single use.
scopeOptional. 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
tokenThe token to revoke, usually the refresh token.
token_type_hintOptional. 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_hintRequired. The latest ID token your app received for the user.
post_logout_redirect_uriOptional. One of the application's sign-out redirect URLs.
stateOptional. 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).

errorMeaning
invalid_clientWrong client ID or secret, the wrong authentication method (use HTTP Basic), or the application is disabled.
invalid_grantThe 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_requestA required parameter is missing or repeated.
invalid_scopeA scope other than openid, profile and email, or more than was granted.
unauthorized_clientA grant type other than authorization_code and refresh_token.
access_deniedAuthorization only: the user declined, or isn't allowed to use the application.