reactjs-ts-identityserver icon indicating copy to clipboard operation
reactjs-ts-identityserver copied to clipboard

No post logout redirect ?

Open SebiNUI opened this issue 7 years ago • 4 comments

@ThunderDev1 I'm trying to use the post logout redirect within a similar SPA client... I noticed you didn't follow the same approach. My question is: did you manage to make post logout redirect work ?

SebiNUI avatar Apr 19 '18 12:04 SebiNUI

Unfortunately no, I didn't get it to work. I did research the issue and as you probably saw, other people seem to have problems making it work.. I'll try to look in to it again when I have the time

ThunderDev1 avatar Apr 25 '18 18:04 ThunderDev1

@ThunderDev1 I did, by creating the following method in the account controller:

[HttpGet] [AllowAnonymous] public async Task<IActionResult> Logout(string logoutId) { var logout = await _interaction.GetLogoutContextAsync(logoutId); await _signInManager.SignOutAsync(); _logger.LogInformation("User logged out."); return Redirect(logout.PostLogoutRedirectUri); }

SebiNUI avatar Apr 26 '18 08:04 SebiNUI

I think id_token_hint should be used in logout-function(Spa - Nav.tsx): const logout = (event: any) => { event.preventDefault(); userManager.getUser() .then(user => { userManager.signoutRedirect({ 'id_token_hint': user.id_token }); }); userManager.removeUser(); };

floodi avatar Sep 06 '19 06:09 floodi

Yes, that seems to be it, according to http://docs.identityserver.io/en/latest/endpoints/endsession.html you also need to pass the post_logout_redirect_uri. For some reason identity server is not providing the id_token, not sure what is missing.

ThunderDev1 avatar Oct 22 '19 21:10 ThunderDev1