SSO & OAuth
OAuth and Single Sign-On (SSO) provide secure authentication for HridaAI. When login problems occur, one of these common issues is usually the cause.
Common OAuth/SSO Issuesβ
1. HridaAI URL Not Configuredβ
Most OAuth flows require the application's external URL ("redirect URI") so the provider knows where to send users after login. If this is missing, OAuth cannot complete.
Solution:
- Navigate to: Admin Settings > General
- Ensure your HridaAI URL field is filled in and points to your deployed instance (e.g.,
https://yourhridaai.yourdomain.com)
Check for typos β OAuth is strict. URLs must match exactly, including https://.
2. Incorrect Environment Variable Configurationβ
This is the most common cause of OAuth breakage. A misspelled, omitted, or incorrect environment variable will prevent authentication from working.
Common Environment Variable Mistakes:
β Non-Existent Variables People Often Use:β
OIDC_CONFIGβ UseOPENID_PROVIDER_URLinsteadHRIDAAI_OIDC_CLIENT_IDβ UseOAUTH_CLIENT_IDinsteadHRIDAAI_ENABLE_SSOβ UseENABLE_OAUTH_SIGNUPinsteadHRIDAAI_AUTH_TYPEβ This doesn't exist - configure provider-specific variables insteadOPENID_CLIENT_IDβ UseOAUTH_CLIENT_IDinsteadOPENID_CLIENT_SECRETβ UseOAUTH_CLIENT_SECRETinstead
β Correct OIDC Variables:β
# Required for OIDC
OAUTH_CLIENT_ID=your_client_id
OAUTH_CLIENT_SECRET=your_client_secret
OPENID_PROVIDER_URL=https://your-provider/.well-known/openid-configuration
ENABLE_OAUTH_SIGNUP=true
# Optional but recommended
OAUTH_PROVIDER_NAME=Your Provider Name
OAUTH_SCOPES=openid email profile
OPENID_REDIRECT_URI=https://your-domain/oauth/oidc/callback
# Optional: pass provider-specific authorize params (JSON object)
# e.g. force consent screen, prefill user/email hint
OAUTH_AUTHORIZE_PARAMS={"prompt":"consent","login_hint":"user@example.com"}β Google-specific optional authorize params:β
# Optional: extra Google /authorize params as JSON
GOOGLE_OAUTH_AUTHORIZE_PARAMS={"prompt":"consent","login_hint":"user@example.com","hd":"example.com"}β Correct Microsoft Variables:β
# Use these for Microsoft Entra ID
MICROSOFT_CLIENT_ID=your_client_id
MICROSOFT_CLIENT_SECRET=your_client_secret
MICROSOFT_CLIENT_TENANT_ID=your_tenant_id
OPENID_PROVIDER_URL=https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0/.well-known/openid-configuration
ENABLE_OAUTH_SIGNUP=trueSolutions:
- Always reference the official environment configuration documentation for exact variable names
- Double-check your deployment environment:
- Ensure all required environment variables are set exactly as documented
- If self-hosting, confirm these variables are present in your Docker Compose, Kubernetes manifest, or
.envfile
- Restart your backend/app after changing variables so the new values are loaded
If your provider needs extra parameters at the /authorize step (for example prompt, login_hint, domain_hint, or resource), set them via OAUTH_AUTHORIZE_PARAMS as a JSON object.
For Google-specific customization, you can also use GOOGLE_OAUTH_AUTHORIZE_PARAMS.
Most OAuth errors (loops, 401s, unresponsiveness) are due to an environment variable that is incorrectly named, missing entirely, or using an outdated variable name.
Kubernetes/YAML users: Watch out for trailing spaces in environment variable names! In YAML, quoting a key like 'OAUTH_CLIENT_ID ' (with a trailing space inside the quotes) will set a variable named OAUTH_CLIENT_ID (with a space at the end), which HridaAI will not recognize. Always ensure your env var names have no trailing whitespace:
# β Wrong β trailing space inside quotes:
- name: 'OAUTH_CLIENT_ID '
value: your_client_id
# β
Correct β no trailing space:
- name: OAUTH_CLIENT_ID
value: your_client_id3. Missing Required Variablesβ
OPENID_PROVIDER_URL is Mandatory for OIDCβ
Many users forget this critical variable. Without it, OIDC authentication cannot work.