Authentication Troubleshooting
Resolve login, JWT, and OAuth issues.
Invalid Credentials
Symptom: 401 Unauthorized on login
Fixes:
- Verify email and password are correct
- Check if user account is active
- Verify the user exists in the database
- Check
BCRYPT_SALT_ROUNDShasn't changed
JWT Token Expired
Symptom: 401 after some time
Fix: The token has expired. Refresh it or increase expiration:
JWT_TOKEN_EXPIRATION_TIME=86400 # 24 hours
Refresh Token Invalid
Symptom: 401 on token refresh
Fixes:
- Tokens are single-use; don't retry with spent tokens
- Check
JWT_REFRESH_SECRETmatches the signing secret - Verify
JWT_REFRESH_EXPIRATION_TIMEhasn't passed
Social Auth Callback Error
Symptom: OAuth login redirects to error page
Fixes:
- Verify callback URL matches in OAuth provider settings
- Check
GOOGLE_CALLBACK_URL/GITHUB_CALLBACK_URLis correct - Ensure client secret hasn't been rotated
Password Reset Failed
Symptom: Password Reset Failed error
Fixes:
- Password must meet complexity requirements (8+ chars, uppercase, lowercase, number, special char)
- Check SMTP is configured for reset emails
- Verify the reset token hasn't expired
Can't Login After Deploy
Symptom: All users get 401 after deployment
Fix: JWT_SECRET must be the same across deployments. If changed, all existing tokens become invalid. Users must re-login.
Related Pages
- Auth Endpoints — auth API
- JWT Authentication — JWT details
- Password Security — password policies