Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added extraTokenParams to UserManager.signinSilent #1258

Merged
merged 2 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions src/OidcClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
export interface UseRefreshTokenArgs {
state: RefreshState;
timeoutInSeconds?: number;
extraTokenParams?: Record<string, unknown>;
}

/**
Expand Down Expand Up @@ -185,6 +186,7 @@
public async useRefreshToken({
state,
timeoutInSeconds,
extraTokenParams

Check failure on line 189 in src/OidcClient.ts

View workflow job for this annotation

GitHub Actions / test

Missing trailing comma
}: UseRefreshTokenArgs): Promise<SigninResponse> {
const logger = this._logger.create("useRefreshToken");

Expand All @@ -207,6 +209,7 @@
// provide the (possible filtered) scope list
scope,
timeoutInSeconds,
...extraTokenParams,
});
const response = new SigninResponse(new URLSearchParams());
Object.assign(response, result);
Expand Down
6 changes: 4 additions & 2 deletions src/UserManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,15 @@
const {
silentRequestTimeoutInSeconds,
resource,
extraTokenParams,
pamapa marked this conversation as resolved.
Show resolved Hide resolved
...requestArgs
} = args;
// first determine if we have a refresh token, or need to use iframe
let user = await this._loadUser();
if (user?.refresh_token) {
logger.debug("using refresh token");
const state = new RefreshState(user as Required<User>, resource);
return await this._useRefreshToken(state);
return await this._useRefreshToken(state, extraTokenParams);
}

const url = this.settings.silent_redirect_uri;
Expand Down Expand Up @@ -324,10 +325,11 @@
return user;
}

protected async _useRefreshToken(state: RefreshState): Promise<User> {
protected async _useRefreshToken(state: RefreshState, extraTokenParams?: Record<string, unknown>): Promise<User> {
pamapa marked this conversation as resolved.
Show resolved Hide resolved
const response = await this._client.useRefreshToken({
state,
timeoutInSeconds: this.settings.silentRequestTimeoutInSeconds,
extraTokenParams

Check failure on line 332 in src/UserManager.ts

View workflow job for this annotation

GitHub Actions / test

Missing trailing comma
});
const user = new User({ ...state, ...response });

Expand Down
Loading