Skip to content

API Reference

Table of Contents

Overview

The Engagifii Identity API implements OAuth 2.0 (RFC 6749) and OpenID Connect Core 1.0 specifications. All endpoints follow standard protocol definitions with additional custom extensions for enhanced functionality.

API Conventions

  • Protocol: HTTPS only (TLS 1.2+)
  • Request Format: application/x-www-form-urlencoded for OAuth endpoints
  • Response Format: JSON (UTF-8 encoded)
  • Date Format: ISO 8601 (YYYY-MM-DDTHH:mm:ssZ)
  • Error Format: OAuth 2.0 error response format

Base URLs

EnvironmentBase URL
Productionhttps://engagifii-identity-live.azurewebsites.net
QA/Staginghttps://engagifii-qa-identity.azurewebsites.net
Developmenthttps://engagifii-dev-identity.azurewebsites.net

Authentication Endpoints

Authorization Endpoint

Initiates the authorization code flow for user authentication.

http
GET /connect/authorize

Request Parameters

ParameterTypeRequiredDescription
client_idstringYesThe client identifier
response_typestringYesMust be code for authorization code flow
redirect_uristringYesCallback URL (must match registered URI)
scopestringYesSpace-separated list of scopes
statestringRecommendedOpaque value for CSRF protection
noncestringRecommendedUnique value for replay protection (OpenID Connect)
response_modestringNoHow authorization response is returned (query, fragment, form_post)
promptstringNoUser interaction preference (none, login, consent)
max_ageintegerNoMaximum authentication age in seconds
ui_localesstringNoPreferred UI languages
login_hintstringNoHint about user's identity
acr_valuesstringNoAuthentication context class references
code_challengestringPKCEBase64url-encoded SHA256 hash of verifier
code_challenge_methodstringPKCEMust be S256

Example Request

http
GET /connect/authorize?
  client_id=webapp&
  response_type=code&
  redirect_uri=https://app.example.com/callback&
  scope=openid profile email&
  state=abc123&
  nonce=n-0S6_WzA2Mj

Success Response

Redirect to callback with authorization code:

https://app.example.com/callback?
  code=AUTHORIZATION_CODE&
  state=abc123

Error Response

Redirect to callback with error:

https://app.example.com/callback?
  error=access_denied&
  error_description=User denied access&
  state=abc123

Token Endpoints

Token Endpoint

Exchanges authorization codes for tokens or refreshes existing tokens.

http
POST /connect/token

Request Headers

http
Content-Type: application/x-www-form-urlencoded

Grant Types

Authorization Code
ParameterTypeRequiredDescription
grant_typestringYesMust be authorization_code
codestringYesAuthorization code from authorize endpoint
redirect_uristringYesMust match authorize request
client_idstringYesClient identifier
client_secretstringConfidentialClient secret
code_verifierstringPKCEOriginal code verifier

Example Request:

http
POST /connect/token
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&
code=abc123&
redirect_uri=https://app.example.com/callback&
client_id=webapp&
client_secret=secret
Client Credentials
ParameterTypeRequiredDescription
grant_typestringYesMust be client_credentials
client_idstringYesClient identifier
client_secretstringYesClient secret
scopestringNoRequested scopes

Example Request:

http
POST /connect/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&
client_id=service&
client_secret=secret&
scope=api.read api.write
Refresh Token
ParameterTypeRequiredDescription
grant_typestringYesMust be refresh_token
refresh_tokenstringYesThe refresh token
client_idstringYesClient identifier
client_secretstringConfidentialClient secret
scopestringNoReduced scope (optional)

Example Request:

http
POST /connect/token
Content-Type: application/x-www-form-urlencoded

grant_type=refresh_token&
refresh_token=def502...&
client_id=webapp&
client_secret=secret

Success Response

json
{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "def50200a7f9f5d3...",
  "id_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "scope": "openid profile email"
}

Error Response

json
{
  "error": "invalid_grant",
  "error_description": "The provided authorization code is invalid or has expired"
}

Token Revocation Endpoint

Revokes access or refresh tokens.

http
POST /connect/revocation

Request Parameters

ParameterTypeRequiredDescription
tokenstringYesToken to revoke
token_type_hintstringNoHint about token type (access_token or refresh_token)
client_idstringYesClient identifier
client_secretstringConfidentialClient secret

Example Request

http
POST /connect/revocation
Content-Type: application/x-www-form-urlencoded
Authorization: Basic base64(client_id:client_secret)

token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...&
token_type_hint=access_token

Success Response

http
HTTP/1.1 200 OK

User Information Endpoints

UserInfo Endpoint

Returns claims about the authenticated user.

http
GET /connect/userinfo
POST /connect/userinfo

Request Headers

http
Authorization: Bearer ACCESS_TOKEN

Success Response

json
{
  "sub": "248289761001",
  "name": "Jane Doe",
  "given_name": "Jane",
  "family_name": "Doe",
  "preferred_username": "j.doe",
  "email": "janedoe@example.com",
  "email_verified": true,
  "picture": "https://example.com/janedoe/photo.jpg",
  "updated_at": "2024-01-15T10:30:00Z"
}

Error Response

http
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer error="invalid_token", error_description="The access token expired"

Discovery Endpoints

OpenID Connect Discovery

Returns OpenID Connect configuration metadata.

http
GET /.well-known/openid-configuration

Success Response

json
{
  "issuer": "https://engagifii-identity-live.azurewebsites.net",
  "authorization_endpoint": "https://engagifii-identity-live.azurewebsites.net/connect/authorize",
  "token_endpoint": "https://engagifii-identity-live.azurewebsites.net/connect/token",
  "userinfo_endpoint": "https://engagifii-identity-live.azurewebsites.net/connect/userinfo",
  "end_session_endpoint": "https://engagifii-identity-live.azurewebsites.net/connect/endsession",
  "check_session_iframe": "https://engagifii-identity-live.azurewebsites.net/connect/checksession",
  "revocation_endpoint": "https://engagifii-identity-live.azurewebsites.net/connect/revocation",
  "introspection_endpoint": "https://engagifii-identity-live.azurewebsites.net/connect/introspect",
  "device_authorization_endpoint": "https://engagifii-identity-live.azurewebsites.net/connect/deviceauthorization",
  "jwks_uri": "https://engagifii-identity-live.azurewebsites.net/.well-known/openid-configuration/jwks",
  "response_types_supported": [
    "code",
    "token",
    "id_token",
    "code id_token",
    "code token",
    "id_token token",
    "code id_token token"
  ],
  "response_modes_supported": [
    "query",
    "fragment",
    "form_post"
  ],
  "grant_types_supported": [
    "authorization_code",
    "client_credentials",
    "refresh_token",
    "implicit",
    "urn:ietf:params:oauth:grant-type:device_code"
  ],
  "subject_types_supported": ["public"],
  "id_token_signing_alg_values_supported": ["RS256"],
  "scopes_supported": [
    "openid",
    "profile",
    "email",
    "address",
    "phone",
    "offline_access",
    "api"
  ],
  "token_endpoint_auth_methods_supported": [
    "client_secret_basic",
    "client_secret_post",
    "private_key_jwt"
  ],
  "claims_supported": [
    "sub",
    "name",
    "family_name",
    "given_name",
    "middle_name",
    "nickname",
    "preferred_username",
    "profile",
    "picture",
    "website",
    "email",
    "email_verified",
    "gender",
    "birthdate",
    "zoneinfo",
    "locale",
    "phone_number",
    "phone_number_verified",
    "address",
    "updated_at"
  ],
  "code_challenge_methods_supported": ["S256"],
  "request_parameter_supported": true,
  "request_object_signing_alg_values_supported": ["RS256"]
}

JSON Web Key Set (JWKS)

Returns the public keys used to verify JWT signatures.

http
GET /.well-known/openid-configuration/jwks

Success Response

json
{
  "keys": [
    {
      "kty": "RSA",
      "use": "sig",
      "kid": "1234567890",
      "x5t": "...",
      "e": "AQAB",
      "n": "...",
      "x5c": ["..."],
      "alg": "RS256"
    }
  ]
}

Session Management Endpoints

End Session Endpoint

Initiates logout and terminates the user session.

http
GET /connect/endsession
POST /connect/endsession

Request Parameters

ParameterTypeRequiredDescription
id_token_hintstringRecommendedID token for identifying session
post_logout_redirect_uristringNoURL to redirect after logout
statestringNoOpaque value returned in redirect

Example Request

http
GET /connect/endsession?
  id_token_hint=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...&
  post_logout_redirect_uri=https://app.example.com/logout-complete&
  state=abc123

Success Response

Redirect to post-logout URI:

https://app.example.com/logout-complete?state=abc123

Check Session Endpoint

Provides an iframe for checking session status (for SPAs).

http
GET /connect/checksession

Returns HTML page with JavaScript for session monitoring.

Token Introspection

Introspection Endpoint

Validates and returns information about a token.

http
POST /connect/introspect

Request Parameters

ParameterTypeRequiredDescription
tokenstringYesToken to introspect
token_type_hintstringNoHint about token type
client_idstringYesClient identifier
client_secretstringYesClient secret

Example Request

http
POST /connect/introspect
Content-Type: application/x-www-form-urlencoded
Authorization: Basic base64(client_id:client_secret)

token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...

Success Response

Active token:

json
{
  "active": true,
  "scope": "openid profile email",
  "client_id": "webapp",
  "username": "jane.doe",
  "exp": 1672531200,
  "iat": 1672527600,
  "nbf": 1672527600,
  "sub": "248289761001",
  "aud": ["api1", "api2"],
  "iss": "https://engagifii-identity-live.azurewebsites.net",
  "jti": "JTI123456"
}

Inactive token:

json
{
  "active": false
}

Request/Response Formats

Standard Error Response

All OAuth endpoints return errors in this format:

json
{
  "error": "error_code",
  "error_description": "Human-readable error description",
  "error_uri": "https://docs.example.com/errors/error_code"
}

Common Error Codes

Error CodeDescription
invalid_requestRequest missing required parameter or malformed
invalid_clientClient authentication failed
invalid_grantAuthorization code or refresh token invalid
unauthorized_clientClient not authorized for grant type
unsupported_grant_typeGrant type not supported
invalid_scopeRequested scope invalid or exceeds granted scope
access_deniedResource owner denied request
unsupported_response_typeResponse type not supported
server_errorServer encountered unexpected error
temporarily_unavailableServer temporarily unable to handle request

JWT Token Structure

Access and ID tokens are JWTs with three parts:

json
{
  "alg": "RS256",
  "typ": "JWT",
  "kid": "1234567890"
}

Payload (Access Token)

json
{
  "nbf": 1672527600,
  "exp": 1672531200,
  "iss": "https://engagifii-identity-live.azurewebsites.net",
  "aud": ["api1", "api2"],
  "client_id": "webapp",
  "sub": "248289761001",
  "auth_time": 1672527600,
  "idp": "local",
  "scope": ["openid", "profile", "email"],
  "amr": ["pwd"],
  "jti": "JTI123456",
  "iat": 1672527600
}

Payload (ID Token)

json
{
  "nbf": 1672527600,
  "exp": 1672531200,
  "iss": "https://engagifii-identity-live.azurewebsites.net",
  "aud": "webapp",
  "nonce": "n-0S6_WzA2Mj",
  "iat": 1672527600,
  "auth_time": 1672527600,
  "sub": "248289761001",
  "name": "Jane Doe",
  "given_name": "Jane",
  "family_name": "Doe",
  "email": "jane.doe@example.com",
  "email_verified": true,
  "amr": ["pwd"],
  "idp": "local"
}

Rate Limiting

API endpoints implement rate limiting:

Endpoint TypeRate LimitWindow
Authorization10 requestsPer minute per IP
Token20 requestsPer minute per client
UserInfo100 requestsPer minute per token
Discovery100 requestsPer minute per IP

Rate limit headers:

http
X-RateLimit-Limit: 20
X-RateLimit-Remaining: 15
X-RateLimit-Reset: 1672531200

CORS Configuration

For browser-based applications:

http
Access-Control-Allow-Origin: https://app.example.com
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Max-Age: 3600

Next Steps: Review Error Handling for comprehensive error management strategies.