Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/authorization/authorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,21 @@ export function initializeWithConfig(initializeParams: InitializeParams) {
: initialize(authToken);
}

/**
* Updates the JWT generator function used by the SDK.
*
* This is useful when the outer context that the `generateJWT` callback
* closes over changes after `initialize()` has already been called
* (e.g., when an upstream auth token is refreshed).
*
* @param newGenerateJWT - A function that returns a Promise resolving to a JWT string.
*/
export function setGenerateJWT(
newGenerateJWT: (payload: GenerateJWTPayload) => Promise<string>
) {
generateJWTGlobal = newGenerateJWT;
}

export function setTypeOfAuthForTestingOnly(authType: TypeOfAuth) {
if (!authType) {
setTypeOfAuth(null);
Expand Down
Loading