Getting Started
Custom website
Prepare a server-rendered website or web application for DocID® OAuth.
Use a custom integration when your platform is not WordPress or when you need direct control over sessions, routing, and profile-based behavior.
Prerequisites
- A backend capable of keeping credentials and tokens secret
- HTTPS callback routes
- A server-side session mechanism
- A DocID® client for each environment
Create two application routes
Your application normally needs:
- A login route that generates
state,nonce, and the PKCE values before redirecting to DocID® - A callback route that validates the response, exchanges the code, reads the approved claims, and creates a local session
Store temporary authorization data in a signed, HTTP-only, secure, same-site cookie or in a server-side transaction store.
Request authorization
Redirect the browser to /oauth2/authorize with:
response_type=codeclient_id=YOUR_CLIENT_IDredirect_uri=https://your-domain.example/auth/docid/callbackscope=openid profile emailstate=RANDOM_UNGUESSABLE_VALUEnonce=RANDOM_UNGUESSABLE_VALUEcode_challenge=BASE64URL_SHA256_CODE_VERIFIERcode_challenge_method=S256Handle the callback
On the server:
- Reject callbacks with a missing or mismatched
state. - Handle an OAuth
errorresponse without exposing technical details to the user. - Exchange the authorization code at
/oauth2/token. - Send the original
code_verifier. - Request
/oauth2/userinfowith the access token. - Map
subto your local account or session. - Remove the temporary OAuth transaction data.