Troubleshooting Guide
This guide addresses common issues encountered when integrating with Optare SSO.
Authentication Errors
invalid_request: nonce is required for openid scope
Cause: The openid scope was requested, but the nonce parameter was missing from the authorization URL.
Solution:
- Ensure your OIDC client is configured to send a
nonce. - For NextAuth.js, set
checks: ["pkce", "state", "nonce"]in your provider configuration. - If constructing the URL manually, generate a random string and append
&nonce=YOUR_RANDOM_STRING.
invalid_request: redirect_uri is required or does not match
Cause: The redirect_uri parameter is missing or does not exactly match one of the URIs registered for your client.
Solution:
- Check the Optare Developer Console to verify your registered Redirect URIs.
- Ensure the URI is exact (including trailing slashes, protocol, etc.).
http://localhost:3000/api/auth/callback/optareis a common pattern for NextAuth.
invalid_client
Cause: The client_id or client_secret is incorrect.
Solution:
- Verify your credentials in the Developer Console.
- Ensure you are not sending
client_secretto the Authorization endpoint (it belongs in the Token endpoint request).
access_denied
Cause: The user clicked "Cancel" or "Deny" on the consent screen. Solution:
- Handle this gracefully in your application (e.g., show a "Login was cancelled" message).
Token Issues
Refresh Token Expired
Cause: The refresh token has expired (default 30 days) or has been revoked. Solution:
- Redirect the user to login again.
Token Revocation
security note: If a refresh token is used after being revoked (or used twice), the entire token family is revoked for security (to prevent replay attacks). If users are suddenly being logged out, check if your application is attempting to use old refresh tokens.
Integration Specifics
NextAuth.js "Try signing in with a different account."
Cause: Usually indicates a failure in the profile callback or a mismatch in the expected user structure.
Solution:
- Enable debug mode in NextAuth:
debug: true. - Check server logs for specific error messages.
- Verify that your
profilecallback correctly mapsid(orsub).
Support
If you continue to experience issues, please contact support with:
- The
client_idyou are using. - The timestamp of the error.
- The specific error message or code.
- A
request_idif available.