Force logout a user upon getting a new token

Sometimes, it can be useful to force logout a logged-in user when they click a link with a new token so they can view a specific publication as a different user with different permissions. Here's how you can implement a link that will automatically log out a user upon a click and redirect them to the desired topic logged in via the token as a different user.

Instead of using the usual link with a token, you can use links with the following structure:

https://myportal.clickhelp.co/logout/?ReturnUrl={link}

Where {link} is a link with a token you are currently using, but with escape characters, like this:

https%3A%2F%2Fmyportal.clickhelp.co%2Farticles%2Fmy-publication%2Fmy-topic%3Ft%3eyJ0eXAiOiJKV1QiLC

Here's a visual representation of the full URL with explanations (clickable):

Logout link with a token

You can find a list of URL escape codes, for example, here: URL escape codes (docs.microfocus.com).

In this scenario, a user first gets to the logout page and gets logged out; then they get redirected to a new URL containing token and get authenticated under a new Power Reader account.