Skip to content

Conversation

brionmario
Copy link
Member

@brionmario brionmario commented Jul 15, 2025

Purpose

This pull request introduces enhancements to the OAuth handling in the @asgardeo/nextjs package, focusing on improved error logging, state management, and code clarity. Key changes include replacing console statements with a centralized logger, addressing React 18 strict mode issues, and refining token handling logic.

OAuth Error Logging Improvements:

  • Replaced console.error statements with logger.error for consistent logging in AsgardeoProvider.tsx. This includes logging OAuth errors and authentication failures with more descriptive messages. [1] [2]
  • Added logging for invalid temporary session tokens and missing session IDs in handleOAuthCallbackAction.ts. [1] [2]
  • Enhanced error logging for JWT session creation failures in handleOAuthCallbackAction.ts.

React 18 Strict Mode Compatibility:

  • Introduced a reRenderCheckRef in AsgardeoProvider.tsx to prevent race conditions caused by React 18's strict mode remounting behavior.

Token Handling Refinements:

  • Improved handling of id_token and access_token in handleOAuthCallbackAction.ts to accommodate variations in property names (idToken, accessToken).

Codebase Maintenance:

  • Added a temporary export for server utilities in index.ts with a note to remove it once documentation is live.
  • Introduced logger import in handleOAuthCallbackAction.ts for centralized logging.

Related Issues

Related PRs

  • N/A

Checklist

  • e2e cypress tests locally verified.
  • Manual test round performed and verified.
  • UX/UI review done on the final implementation.
  • Documentation provided. (Add links if there are any)
  • Unit tests provided. (Add links if there are any)
  • Integration tests provided. (Add links if there are any)

Security checks

@brionmario brionmario merged commit 1e2902b into asgardeo:main Jul 15, 2025
2 of 4 checks 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