chore: expose getAccessToken
& exchangeToken
from useAsgardeo
#135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request introduces support for token exchange functionality across the JavaScript, React, and Next.js SDKs for Asgardeo. The main changes include adding a new
exchangeToken
method to the core client interfaces and implementations, updating context types and providers to expose this method, and ensuring proper type imports and usage throughout the codebase.Token Exchange Feature Integration
exchangeToken
method to theAsgardeoClient
interface and its abstract implementation inAsgardeoJavaScriptClient
, enabling token swapping based on a provided configuration. [1] [2]exchangeToken
method in bothAsgardeoReactClient
andAsgardeoNextClient
, delegating to the underlying Asgardeo client and handling session IDs as needed. [1] [2]Context and Provider Updates (React SDK)
AsgardeoContextProps
type and the default context value to include the newexchangeToken
method, making it available to React consumers. [1] [2]exchangeToken
method to the context provider, ensuring it is correctly exposed to all components using the context.Type and Import Adjustments
TokenExchangeRequestConfig
wherever token exchange functionality is used, ensuring type safety and consistency in all relevant files. [1] [2] [3] [4] [5] [6]Next.js Server Integration
exchangeToken
utility to the Next.js server-sideasgardeo.ts
helper, allowing server-side code to perform token exchanges using the SDK.These changes collectively enable secure and flexible token exchange operations for applications using the Asgardeo SDKs.
Related Issues
@asgardeo/react
&@asgardeo/nextjs
#81Related PRs
Checklist
Security checks