Skip to main content
The User Authentication flow uses OAuth 2.0 Authorization Code with OpenID Connect (OIDC) for applications that need to authenticate end users. This is an SP-initiated flow where users are redirected to SmarterServices to login.

Overview

Obtaining Client Credentials

Contact your SmarterProctoring account manager to:
  1. Register your application as an OIDC client
  2. Receive your Client ID (Integration SID)
  3. Receive your Client Secret
  4. Register your Redirect URI(s) - Must be HTTPS
  5. Configure additional options:
    • PKCE requirement - Recommended for public clients
    • Consent display policy - never, once, or always
    • Token lifetimes - Custom access/refresh token TTLs
    • Back-channel logout URI - For session synchronization

Step 1: Redirect User to Authorization Endpoint

When a user wants to authenticate, redirect them to:
Query Parameters: Example redirect URL:

PKCE (Proof Key for Code Exchange)

PKCE is strongly recommended for all clients and required for public clients (SPAs, mobile apps) where the client secret cannot be securely stored. Generating the code challenge:
When PKCE is enabled for your integration, you must include code_challenge and code_challenge_method=S256 in the authorization request, then provide the original code_verifier when exchanging the code for tokens.

Security Recommendations

  • Always include state - Generate a cryptographically random value, store it in session, and validate it matches in the callback
  • Include nonce - Required for ID token validation to prevent replay attacks
  • Use PKCE - Required for public clients, recommended for all
  • Validate redirect_uri - Must exactly match a registered URI (no wildcards)

Step 2: User Authenticates

The user will be presented with a SmarterServices login page where they:
  1. Enter their credentials (email/password)
  2. Complete Multi-Factor Authentication (if enabled for their account)
  3. Grant consent (based on your integration’s consent policy)
The consent screen behavior is configured per integration: The consent screen displays:
  • Your application name
  • The list of requested scopes (in human-readable form)
  • The redirect destination
  • Allow and Deny buttons
If the user denies, they are redirected to your redirect_uri with error=access_denied. Contact your account manager to configure your integration’s consent policy.

Step 3: Handle the Authorization Callback

After successful authentication, the user is redirected back to your redirect_uri:
Important: Verify the state parameter matches what you sent to prevent CSRF attacks. Error handling: If authentication fails, you’ll receive:

Step 4: Exchange Code for Tokens

Send a POST request to the token endpoint to exchange the authorization code for tokens:
Parameters: Authorization codes are single-use and expire after 10 minutes.

Token Response

Response Fields:
  • access_token - JWT for accessing API resources on behalf of the user
  • id_token - JWT containing user identity claims (name, email, etc.)
  • refresh_token - Token to obtain new access tokens (when enabled)
  • expires_in / expires_at - Access token expiration (1 hour)

ID Token Claims

The ID token contains user identity information:

Scopes for User Authentication

Example scope request:

Using the Access Token

Include the access token in the Authorization header when calling API endpoints:

Refresh Tokens

When refresh tokens are enabled for your integration, you can obtain a new access token without requiring the user to re-authenticate:
Refresh Token Details:
  • Lifetime: Configurable per integration (default 7 days, can be set up to indefinite)
  • Revocation: All tokens in a grant family are revoked together when the user logs out
  • Single-grant scope: Each refresh token belongs to a specific user + integration combination
Security Note: Store refresh tokens securely (encrypted at rest). Contact your account manager to enable refresh tokens or adjust their lifetime for your integration.

UserInfo Endpoint

Retrieve the authenticated user’s profile information using the access token:
Response:
The returned claims depend on the scopes granted during authorization.

Logout

Front-Channel Logout

To log out a user, revoke their tokens:
This revokes the access token, refresh token, and all related tokens in the same grant family.

Back-Channel Logout

If you’ve registered a backchannel_logout_uri for your integration, SmarterServices will notify your application when a user’s session is terminated (for example, when they log out of another connected application or when their account is suspended). Notification format:
The logout_token is a signed JWT containing:
Your endpoint should:
  1. Verify the logout_token signature using the JWKS endpoint
  2. Validate iss, aud, and events claims
  3. Terminate the user’s local session(s) for the sub (user ID)
  4. Respond with 200 OK
Back-channel logout follows the OpenID Connect Back-Channel Logout 1.0 specification.

Error Responses

Authorization Endpoint Errors

When errors occur during the authorization request, the user is redirected back to your redirect_uri with error parameters: Example error redirect:

Token Endpoint Errors

Returned as JSON with HTTP status 400:

401 Unauthorized

Returned when the request lacks valid authentication credentials or the token has expired. Response includes:

403 Forbidden

Returned when the token is valid but the user does not have permission for the requested action.

SDKs and Libraries

Node.js Python
  • authlib - OAuth 1.0, OAuth 2.0, and OpenID Connect library
  • oauthlib - Generic OAuth library
Java PHP

Token Verification

ID tokens and access tokens are JWTs signed with RSA keys. Use the JWKS endpoint to retrieve public keys for verification:
ID Token validation steps:
  1. Verify the JWT signature using the matching key from JWKS
  2. Validate iss matches https://api.smarterservices.com/oidc
  3. Validate aud matches your client_id
  4. Validate exp is in the future
  5. Validate nonce matches the value you sent in the authorization request
  6. Validate iat is reasonably recent
Most OIDC libraries handle these checks automatically when configured with your client information.

Token Security

  • Store tokens securely - Encrypt at rest, use secure storage (Keychain, KeyStore, etc.)
  • Use HTTPS - All redirect URIs must use HTTPS
  • Validate state - Always verify the state parameter matches
  • Validate ID token - Verify signature, issuer, audience, expiration, and nonce
  • Short-lived access tokens - Default 1 hour lifetime
  • Secure refresh tokens - Store separately from access tokens, encrypt at rest
  • Implement logout - Revoke tokens when user logs out
  • Use PKCE - Especially for public clients
  • Monitor for abuse - Log and alert on suspicious token usage

← Back to Authentication Overview