Overview
OAuth 2.0 allows your application to:- Authenticate users with their DHMAD accounts
- Access user information (with permission)
- Provide seamless SSO experience
Getting Your OAuth Credentials
- Log into the Developer Dashboard
- Navigate to the “OAuth Client Credentials” section
- Copy your Client ID and Client Secret
Configuring Redirect URIs
Redirect URIs must be full URLs including a path. During authorization, theredirect_uri parameter must exactly match one of your registered URIs.
OAuth Flow
The OAuth 2.0 authorization code flow with PKCE:- Authorization Request - Redirect user to authorization endpoint (the
stateparameter is required) - Consent Screen - User sees which application is requesting access and what permissions (scopes) are being requested
- User Authentication - User logs in with their DHMAD account
- Authorization - User authorizes the application
- Authorization Code - User is redirected back with code and state
- Token Exchange - Exchange code for access token
- User Info - Use access token to get user information
Implementation Example
Scopes
Available OAuth scopes:openid- OpenID Connect (required for ID token)profile- User profile informationemail- User email address
Security Best Practices
Use PKCE (S256)
Always use PKCE with the S256 code challenge method (plain is not supported)
HTTPS Only
Always use HTTPS for redirect URIs in production
State is Required
The
state parameter is mandatory. Requests without it are rejected. Generate a unique random value per request and validate it on callback to prevent CSRF attacks.Secure Storage
Store tokens securely, never in localStorage for sensitive apps
Consent Screen
When a user is redirected to the authorization endpoint, they are shown a consent screen that displays:- Your application name (as registered in the Developer Dashboard)
- Requested permissions (scopes) with clear descriptions of what data will be shared
redirect_uri with error=access_denied.
Client Info Endpoint
You can retrieve public information about an OAuth client (useful for pre-flight checks):Discovery Endpoint
Get OAuth configuration:Support
For OAuth integration help, contact support@dhmad.tnOAuth credentials are automatically generated when you first access your developer dashboard. You can regenerate your client secret at any time.