authts / oidc-client-ts

OpenID Connect (OIDC) and OAuth2 protocol support for browser-based JavaScript applications
https://authts.github.io/oidc-client-ts/
Apache License 2.0
1.41k stars 214 forks source link

Provider specific settings for Azure B2C #1678

Open esinmy opened 2 months ago

esinmy commented 2 months ago

I faced a few issues when setting up the configuration for Azure B2C, but it finally works.

The documentation has a section titled 'Provider-specific settings' which contains a configuration for Amazon Cognito. I would suggest adding the following for Azure B2C.

const mgr = new UserManager({
  // ...
  // automaticSilentRenew is turned off because redirect_uri is not passed to the signinSilent call inside SilentRenewService._tokenExpiring (oidc-client-ts.js)
  // If redirect_uri is not passed, it causes the error: "AADB2C90083: The request is missing required parameter: redirect_uri" during silent sign-in.
  // To handle automaticSilentRenew manually, userManager.events.addAccessTokenExpiring is set as shown below.
  automaticSilentRenew: false,
});

mgr.events.addAccessTokenExpiring(() => void userManager.signinSilent({redirect_uri}))
pamapa commented 2 months ago

The documentation has a section titled 'Provider-specific settings' which contains a configuration for Amazon Cognito. I would suggest adding the following for Azure B2C.

Yes, please provide this section as a merge-request or if not possible post the text here you like.