signoutRedirect of oidc-client-js against Auth0 returns no end session endpoint

时间秒杀一切 提交于 2019-12-10 13:40:10

问题


I've successfully used the oidc-client-js library by Brock Allen to authenticate my SPA app with Auth0 acting as my Identity Provider. However, when I try to use the library to sign the user out mgr.signoutRedirect({state: "my test"}), I receive an error: no end session endpoint.

A look at the metadata endpoint shows that there is a revocation endpoint.

I've configured the oidc-client-js library like so:

var settings = {
   authority: 'https://susqsofttest.auth0.com/.well-known/openid-configuration',
   client_id: 'my client id',
   redirect_uri: 'http://localhost:8080/signin-oidc',
   post_logout_redirect_uri: 'http://localhost:8080/logout',
   response_type: 'id_token token',
   scope: 'openid profile email',
   revokeAccessTokenOnSignout: true,
   automaticSilentRenew: true,
   filterProtocolClaims: true,
   loadUserInfo: true
};
var mgr = new UserManager(settings);

Any ideas of what I'm missing?


回答1:


signout redirect explicitly looking at the Json property "end_session_endpoint" in your idp configuration, I do not see that endpoint in your idp configuration, and I guess, this is not something that you can override with oidc-client.js package.

Check this out on how they are retrieving the endpoint url from metadata. https://github.com/IdentityModel/oidc-client-js/blob/dev/src/OidcClient.js#L124




回答2:


You can give metadata for oidc client by adding metadata section to user manager settings.

var settings = {
authority: 'https://susqsofttest.auth0.com/.well-known/openid-configuration',
client_id: 'my client id',
redirect_uri: 'http://localhost:8080/signin-oidc',
post_logout_redirect_uri: 'http://localhost:8080/logout',
response_type: 'id_token token',
scope: 'openid profile email',
revokeAccessTokenOnSignout: true,
automaticSilentRenew: true,
filterProtocolClaims: true,
loadUserInfo: true,
metadata: {
  issuer: `https://sts.windows.net/${tenant}/`,
  authorization_endpoint: `https://login.microsoftonline.com/${tenant}/oauth2/authorize`,
  token_endpoint: `https://login.microsoftonline.com/${tenant}/oauth2/token`,
  jwks_uri: 'https://login.microsoftonline.com/common/discovery/keys',
  end_session_endpoint: `https://login.microsoftonline.com/${tenant}/oauth2/logout`
}
};

This example is when using AzureAD. end_session_endpoint can be also your SPA route address like ${window.location.origin}/logout but then azure ad session won't end.

You can also set metadataUrl instead of metadata. 'https://login.microsoftonline.com/YOUR_TENANT_NAME.onmicrosoft.com/.well-known/openid-configuration',



来源:https://stackoverflow.com/questions/50844515/signoutredirect-of-oidc-client-js-against-auth0-returns-no-end-session-endpoint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!