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

Add config argument to getAccessTokenWithPopup #141

Merged
merged 1 commit into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions src/auth0-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export interface Auth0ContextInterface extends AuthState {

/**
* ```js
* const token = await getTokenWithPopup(options);
* const token = await getTokenWithPopup(options, config);
* ```
*
* Get an access token interactively.
Expand All @@ -76,7 +76,8 @@ export interface Auth0ContextInterface extends AuthState {
* results will be valid according to their expiration times.
*/
getAccessTokenWithPopup: (
options?: GetTokenWithPopupOptions
options?: GetTokenWithPopupOptions,
config?: PopupConfigOptions
) => Promise<string>;

/**
Expand Down
6 changes: 4 additions & 2 deletions src/auth0-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
PopupLoginOptions,
PopupConfigOptions,
RedirectLoginOptions as Auth0RedirectLoginOptions,
GetTokenWithPopupOptions,
} from '@auth0/auth0-spa-js';
import Auth0Context, { RedirectLoginOptions } from './auth0-context';
import { hasAuthParams, loginError, wrappedGetToken } from './utils';
Expand Down Expand Up @@ -237,8 +238,9 @@ const Auth0Provider = (opts: Auth0ProviderOptions): JSX.Element => {
getAccessTokenSilently: wrappedGetToken((opts?) =>
client.getTokenSilently(opts)
),
getAccessTokenWithPopup: wrappedGetToken((opts?) =>
client.getTokenWithPopup(opts)
getAccessTokenWithPopup: wrappedGetToken(
(opts?: GetTokenWithPopupOptions, config?: PopupConfigOptions) =>
client.getTokenWithPopup(opts, config)
),
getIdTokenClaims: (opts): Promise<IdToken> =>
client.getIdTokenClaims(opts),
Expand Down