Closed DaveOrDead closed 3 months ago
The recent updates introduce a new GetTokenOptions
parameter to the getTokenType
function in src/createKindeClient.ts
, and modify the getToken
and getIdToken
functions to utilize this parameter. This enhancement allows for additional options during token retrieval, specifically the option to force a token refresh. The GetTokenOptions
type, which includes an optional isForceRefresh
boolean property, has been added to src/types.ts
to support this functionality.
File | Change Summary |
---|---|
src/createKindeClient.ts |
Added GetTokenOptions parameter to getTokenType , getToken , and getIdToken functions. |
src/types.ts |
Introduced GetTokenOptions type with an optional isForceRefresh boolean property. |
sequenceDiagram
participant Client
participant KindeClient
participant AuthServer
Client->>KindeClient: getToken(options: GetTokenOptions)
alt isForceRefresh is true
KindeClient->>AuthServer: Request new token
AuthServer-->>KindeClient: Return new token
else isForceRefresh is false or undefined
KindeClient->>KindeClient: Retrieve cached token
end
KindeClient-->>Client: Return token
sequenceDiagram
participant Client
participant KindeClient
participant AuthServer
Client->>KindeClient: getIdToken(options: GetTokenOptions)
alt isForceRefresh is true
KindeClient->>AuthServer: Request new ID token
AuthServer-->>KindeClient: Return new ID token
else isForceRefresh is false or undefined
KindeClient->>KindeClient: Retrieve cached ID token
end
KindeClient-->>Client: Return ID token
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Explain your changes
The forceRefresh option will always call the Kinde token endpoint to get the latest version of the tokens
Checklist
🛟 If you need help, consider asking for advice over in the Kinde community.