In the request
- Generate a new
stateandnoncefor every request and check them on return - Use PKCE with
S256even when your app has a secret - Use only HTTPS redirect URIs in production
import crypto from 'node:crypto';
const verifier = crypto.randomBytes(32).toString('base64url');
const challenge = crypto.createHash('sha256').update(verifier).digest('base64url');
// send challenge with code_challenge_method=S256, keep verifier in the session
// and post it as code_verifier when exchanging the codeThe secret
- Keep
client_secretin environment variables or a secret store, never in the repository - If the secret leaks, regenerate it in the portal and the old one stops working at once
- Create separate integrations for testing and production
Tokens and session
- Verify the ID token signature,
iss,aud,expandnonce - After login create your own session with an
HttpOnly,SecureandSameSitecookie - Do not send the ID token or personal code to the browser unless needed
- Do not write tokens or full personal codes to logs
What Dorvis does
- Provider keys and your credentials are kept in a separate secure vault
- Every login is recorded for statistics and audit
- Dorvis runs in Latvia, and data processing complies with GDPR
Did not find the answer?
Write to us and a developer will reply.






