Troubleshooting
Microsoft 365 Issues
Troubleshoot SSO login and Outlook email integration.
Microsoft 365 Issues
Common problems with Microsoft 365 SSO login and Outlook email integration.
SSO Login Issues
"Sign in with Microsoft" Does Nothing
- Check that Supabase Dashboard → Authentication → Providers → Azure is enabled
- Verify the Azure Client ID and Secret are correct
- Ensure the redirect URI
https://<project-ref>.supabase.co/auth/v1/callbackis registered in Azure AD
"AADSTS50011: The redirect URI does not match"
Add this exact URL to Azure AD → Authentication → Web redirect URIs:
https://eitztntfwelucezqxjmw.supabase.co/auth/v1/callbackUser Created but No Workspace
- Check
/auth/callbackhandling — workspace creation may have failed - Look at Supabase Edge Function logs for errors during onboarding
- Manually create a workspace via Settings → Workspace
Email Connection Issues
"OAuth session expired" on Callback
- The httpOnly cookie wasn't sent by the browser
- Check that your domain supports cookies (not localhost without HTTPS)
- Ensure
SameSite=LaxandSecureflags are set correctly
"Failed to obtain access token"
- Client secret may be wrong or expired
- Go to Azure Portal → Certificates & secrets and verify
- Regenerate the secret if needed and update
MICROSOFT_CLIENT_SECRET
"AADSTS700016: Application not found"
- Wrong
MICROSOFT_CLIENT_ID - Or the app registration was deleted
- Verify the Client ID matches your Azure AD app
Sync Issues
Emails Not Syncing
- Check
user_email_connections.is_active— may be deactivated after 10 errors - Check
user_email_connections.connection_errorfor details - Verify
NEXT_PUBLIC_APP_URLis set correctly (not localhost on production)
Token Refresh Fails
- Refresh token may be revoked by user or admin
MICROSOFT_CLIENT_SECRETmay have expired- User needs to reconnect their account
Webhook Issues
Webhooks Not Receiving Notifications
- Verify
https://workestra.app/api/webhooks/outlookis publicly accessible - Check subscription hasn't expired (3-day max TTL for Microsoft)
- Verify
user_email_connections.webhook_subscription_idis set - Check
MICROSOFT_WEBHOOK_SECRETenvironment variable is configured
Admin Consent Issues
"AADSTS90094: Admin consent is required"
Your organization requires admin approval. Options:
- Ask your IT admin to approve Workestra in Azure AD
- If you're an admin, use the Admin Consent flow:
- Navigate to
/api/auth/outlook/admin-consent - Sign in as an Azure AD Global Admin or Application Admin
- Approve for the entire organization
- Navigate to
Environment Variables Checklist
| Variable | Purpose | Common Mistake |
|---|---|---|
MICROSOFT_CLIENT_ID | Azure app ID | Using Secret ID instead of Application ID |
MICROSOFT_CLIENT_SECRET | App secret | Using Secret ID instead of Value |
MICROSOFT_REDIRECT_URI | Callback URL | Trailing slash mismatch |
TOKEN_ENCRYPTION_KEY | AES key | Not exactly 64 hex characters |
MICROSOFT_WEBHOOK_SECRET | Webhook validation | Missing or mismatched |