IdentityModel / oidc-client-js

OpenID Connect (OIDC) and OAuth2 protocol support for browser-based JavaScript applications
Apache License 2.0
2.43k stars 842 forks source link

Allow custom parameters to be set in silent renew #1356

Open ShivaniDemra opened 3 years ago

ShivaniDemra commented 3 years ago

I have implemented silent renew in my react app. I am sending extraTokenParams (appId and domain) when authorizing using IdentityServer4. I need to pass the same custom parameters when the token is being refreshed. Could not find a way to do it.

Code snippet for authorize endpoint: mgr.signinRedirectCallback(window.location.href).then(function () { window.location = "/"; }).catch(function (e) { mgr.signinRedirect({ extraTokenParams: { appId: 1111, domain:"xyz.com" }} ); });

For silent renew I am using below:

const stsSettings = { authority: "XXXX", client_id: "XXXX", response_type: "code", scope: "openid profile" }; new Oidc.UserManager(stsSettings).signinSilentCallback().then(response => { console.log(response); }).catch(error => { console.error(error); });

Adding extra params to stsSettings did not work.