Skip to content

OIDC Reference

Complete reference for BlokSec’s OpenID Connect implementation. For a step-by-step integration guide, see the OIDC Quickstart.

https://api.bloksec.io

All OIDC endpoints are under the /oidc path.

GET /oidc/.well-known/openid-configuration

Returns the full OIDC discovery document with all endpoint URLs, supported scopes, grant types, and signing algorithms. Most OIDC client libraries use this endpoint for automatic configuration.

GET /oidc/auth

Starts the authentication flow. Redirect the user’s browser to this endpoint.

ParameterRequiredDescription
client_idYesApplication’s Client ID (DID)
redirect_uriYesMust match a registered redirect URI
response_typeYescode for authorization code flow
scopeYesSpace-separated scopes (must include openid)
stateRecommendedRandom value for CSRF protection
nonceRecommendedRandom value included in the ID token
promptNologin forces re-authentication, consent forces consent screen
code_challengeRequired for public clientsS256 PKCE challenge
code_challenge_methodRequired for public clientsMust be S256

On success, redirects to redirect_uri with:

  • code — authorization code (valid for 10 minutes)
  • state — echo of your state parameter
POST /oidc/token
Content-Type: application/x-www-form-urlencoded

Exchanges an authorization code for tokens.

ParameterRequiredDescription
grant_typeYesauthorization_code
codeYesThe authorization code from the callback
redirect_uriYesMust match the redirect_uri from the authorization request
client_idYesApplication’s Client ID
client_secretConfidential clientsApplication’s client secret
code_verifierPublic clientsPKCE code verifier
ParameterRequiredDescription
grant_typeYesrefresh_token
refresh_tokenYesA previously issued refresh token
client_idYesApplication’s Client ID
client_secretConfidential clientsApplication’s client secret
ParameterRequiredDescription
grant_typeYesclient_credentials
client_idYesApplication’s Client ID
client_secretYesApplication’s client secret
scopeNoRequested scopes
{
"access_token": "eyJhbGci...",
"id_token": "eyJhbGci...",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "...",
"scope": "openid email profile"
}
GET /oidc/userinfo
Authorization: Bearer {access_token}

Returns claims about the authenticated user based on the scopes granted.

{
"sub": "did:bloksec:abc123",
"email": "user@example.com",
"email_verified": true,
"given_name": "Jane",
"family_name": "Smith",
"name": "Jane Smith"
}
GET /oidc/jwks

Returns the JSON Web Key Set used to sign tokens. Use these keys to verify ID token and access token signatures.

GET /oidc/end_session

RP-initiated logout. Redirect the user to this endpoint to end their BlokSec session.

ParameterRequiredDescription
id_token_hintRecommendedThe ID token issued to the client
post_logout_redirect_uriNoMust match a registered post-logout redirect URI
stateNoEchoed back in the redirect
EndpointMethodDescription
/oidc/introspectPOSTToken introspection (RFC 7662)
/oidc/revokePOSTToken revocation (RFC 7009)
ScopeClaims included
openidsub, aud, amr
emailemail, email_verified
profilegiven_name, family_name, name, nickname, picture, preferred_username, updated_at, account, upn, user_did
phonephone_number, phone_number_verified
offline_accessGrants a refresh token

The openid scope is required for all requests.

TokenLifetime
Access token1 hour
ID token1 hour
Authorization code10 minutes
Refresh token7 days
Client credentials10 minutes
Grant typeDescription
authorization_codeStandard browser-based login (default)
refresh_tokenRefresh an expired access token
client_credentialsServer-to-server authentication

PKCE (Proof Key for Code Exchange) is required for public clients (where token_endpoint_auth_method is none). Only the S256 challenge method is supported.

Token endpoint errors follow RFC 6749:

{
"error": "invalid_grant",
"error_description": "Authorization code has expired"
}

Common errors:

ErrorDescription
invalid_clientClient authentication failed
invalid_grantAuthorization code is invalid or expired
invalid_scopeRequested scope is not allowed
unauthorized_clientClient is not authorized for this grant type