Merge pull request #17 from matmunn/allow-adding-custom-options

Allow passing through extra options to oidc-client
This commit is contained in:
Darrel O'Pry 2021-07-15 17:10:48 -04:00 committed by GitHub
commit 81ad5ae7a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -49,6 +49,10 @@ const metadata = {
redirect_uri="https://darrelopry.com/svelte-oidc/" redirect_uri="https://darrelopry.com/svelte-oidc/"
post_logout_redirect_uri="https://darrelopry.com/svelte-oidc/" post_logout_redirect_uri="https://darrelopry.com/svelte-oidc/"
metadata={metadata} metadata={metadata}
extraOptions={{
mergeClaims: true,
resource: "some_identifier",
}}
> >
<LoginButton>Login</LoginButton> <LoginButton>Login</LoginButton>
@ -113,6 +117,7 @@ the migration hard.
* redirect_uri - default: window.location.href * redirect_uri - default: window.location.href
* post_logout_redirect_uri - override the default url that OIDC will redirect to after logout. default: window.location.href * post_logout_redirect_uri - override the default url that OIDC will redirect to after logout. default: window.location.href
* metadata - set default metadata or metadata missing from authority. * metadata - set default metadata or metadata missing from authority.
* extraOptions - An object of extra options that will be passed to the underlying OpenID Connect client. Valid values are available [here](https://github.com/IdentityModel/oidc-client-js/wiki#other-optional-settings).
* LoginButton - log out the current context * LoginButton - log out the current context

View file

@ -104,6 +104,7 @@
export let client_id; export let client_id;
export let redirect_uri; export let redirect_uri;
export let post_logout_redirect_uri; export let post_logout_redirect_uri;
export let extraOptions = {};
export let scope = 'openid profile email'; export let scope = 'openid profile email';
@ -118,6 +119,7 @@
response_type: 'code', response_type: 'code',
scope, scope,
automaticSilentRenew: true, automaticSilentRenew: true,
...extraOptions,
}; };
const userManager = new oidcClient.UserManager(settings); const userManager = new oidcClient.UserManager(settings);