Skip to content

Docs / Developers

OpenID Connect reference

Endpoints, scopes, ID token claims, token lifetimes and error codes for Sign in with Prodmail.

View as Markdown

Endpoints#

Address
Issuer https://api.prodmail.io
Discovery https://api.prodmail.io/.well-known/openid-configuration
Authorization https://account.prodmail.io/oauth/authorize
Token https://api.prodmail.io/v1/oauth/token
User info https://api.prodmail.io/v1/oauth/userinfo
Signing keys (JWKS) https://api.prodmail.io/v1/oauth/jwks

What is supported#

Flow Authorization code (response_type=code)
PKCE Required, S256 only
Client authentication client_secret_basic, client_secret_post, or none for apps with no secret
ID token signing RS256
Scopes openid, profile, email

Authorization request#

Parameter
client_id Required. Your app's client ID.
redirect_uri Required. One of your callback URLs, exactly.
response_type Required. code.
scope Required. Must include openid. Add profile and email as needed.
code_challenge Required. The base64url SHA-256 of your code verifier.
code_challenge_method Required. S256.
state Recommended. Returned to you unchanged. Up to 512 characters.
nonce Optional. Returned in the ID token.

The code verifier is 43 to 128 characters from A-Z a-z 0-9 - . _ ~.

Token request#

POST to the token endpoint with a form body (application/x-www-form-urlencoded):

Parameter
grant_type authorization_code
code The code from your callback. It lasts 60 seconds and works once.
redirect_uri The same callback URL as in the authorization request.
code_verifier The verifier whose challenge you sent.
client_id, client_secret In the body, or as HTTP Basic authentication. An app with no secret sends client_id only.

Call it from your server. A code that fails an exchange is spent; start the flow again.

Scopes and claims#

Scope Claims
openid sub
profile name
email email, email_verified

The ID token also carries iss, aud, exp, iat, auth_time, and nonce if you sent one.

  • sub is the account's permanent ID. It is the same for every app and never changes; store it, not the email address, as the key for a person.
  • name is the person's display name.
  • email is the account's own address. email_verified is always true: the address is Prodmail's to vouch for.

Lifetimes#

Authorization code 60 seconds, single use
ID token 1 hour
Access token 1 hour, accepted only by the user info endpoint
Refresh tokens None

Signing keys can change. Fetch them from the JWKS address and pick the key by the token's kid; don't pin one.

A person is asked once per app. Asking for a scope they haven't allowed yet asks again. If they remove your app's access, its tokens stop working and the next sign-in asks again.

Errors#

Faults in a request from a known app come back to your callback URL as error, with error_description and your state:

error Meaning
access_denied The person chose Cancel.
invalid_request A parameter is missing or malformed, for example no PKCE challenge.
unsupported_response_type response_type is not code.
invalid_scope openid is missing, or a scope isn't one of the three.

Two faults are shown on Prodmail's own page and never sent to your callback, because the return address can't be trusted: an unknown client_id, and a redirect_uri that isn't registered for the app.

The token endpoint answers with a JSON body of error and error_description:

error Meaning
invalid_client Wrong client ID or secret, or the app has been deleted.
invalid_grant The code is wrong, expired, already used, or doesn't match the callback URL or verifier.
unsupported_grant_type grant_type is not authorization_code.
slow_down Too many requests. Wait and try again.

The user info endpoint answers 401 with invalid_token when the access token is missing, wrong or expired.

Something here wrong or missing? Write to help@prodmail.io.