Skip to content

Conversation

@TharakaUJ
Copy link
Contributor

Purpose

This PR introduces getIdToken API and exposes the following token-related APIs via the Next.js SDK context for parity with the React SDK:

  • getDecodedIdToken
  • getIdToken
  • getAccessToken
  • exchangeToken

This allows Next.js applications to access both raw and decoded tokens and perform token exchange using the same API surface as React.

Related Issues

Related PRs

Checklist

  • Followed the CONTRIBUTING guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
  • Unit tests provided. (Add links if there are any)

Security checks

expose getIdToken, getDecodedIdToken, getAccessToken, and exchangeToken
methods through AsgardeoContext in the Next.js SDK.
@TharakaUJ TharakaUJ force-pushed the nextjs-get-id-token branch from 858a7c5 to 3115040 Compare February 1, 2026 12:26
@asgardeo-github-bot
Copy link

⚠️ No Changeset found

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go.

If these changes should result in a version bump, you need to add a changeset.

Refer Release Documentation to learn how to add a changeset.

@TharakaUJ
Copy link
Contributor Author

I haven't still test the code in action, I'll attach a screenshot once I'm done and open the PR.

Copy link
Contributor Author

@TharakaUJ TharakaUJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package is building fine now, but I noticed that the Next.js SDK has a separate server-side provider under packages/nextjs/src/server.

For now, to avoid build failures, I wired these methods through the existing client implementation.

I'm wondering whether I should follow the same pattern as in signIn, signOut etc. and create some implementation in packages/nextjs/src/server/actions.

@brionmario any advice?

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