Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📜 refactor: Log Error Messages when OAuth Fails #5337

Merged
merged 1 commit into from
Jan 18, 2025

Conversation

ragavpr
Copy link
Contributor

@ragavpr ragavpr commented Jan 17, 2025

Summary

When OAuth Authentication fails, passport is configured to redirect to login page, the error message is stored in req.session.messages but not logged. Resulting in no OAuth logs being printed and making it harder to debug OAuth issues.

This fix adds a new route /oauth/error to handle and log OAuth errors before redirecting to login page.

Change Type

Please delete any irrelevant options.

  • Bug fix (non-breaking change which fixes an issue)

Testing

Any previously failed OAuth login attempts without any errors logged will log after this commit.

For me, Currently ES256 JWT algorithm results in OAuth failure and no logs produced, tested that the error message is logged correctly after the change.

Test Configuration:

  • Authentik with EC keys as OIDC provider.
  • Full FQDN production ready setup with SSL, Nginx as reverse proxy.

Checklist

Please delete any irrelevant options. (removed documentation items)

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes

@ragavpr ragavpr force-pushed the handle-oidc-failures branch from 8ed9cb4 to 6a0f8da Compare January 17, 2025 10:41
@ragavpr ragavpr force-pushed the handle-oidc-failures branch from 6a0f8da to d68fb59 Compare January 17, 2025 10:43
@danny-avila danny-avila changed the title fix: log error messages when OAuth fails. 📜 refactor: Log Error Messages when OAuth Fails Jan 18, 2025
@danny-avila danny-avila merged commit d048a10 into danny-avila:main Jan 18, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants