question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enhancement Request: Allow `logout` to be passed arguments for `state`

See original GitHub issue

Enhancement Request: Allow logout to be passed arguments for state

As near as I can tell, under the hood, react-oidc is calling into oidc-client-js’s UserManager’s signoutRedirect instance method in order to prompt a logout. signoutRedirect accepts an args object, which can include a state property, which would be forwarded to any URL passed for end_session_endpoint as a query param.

It would be nice if the logout method made available via the various packages could be made to accept args (or possibly just state) so that it could be passed through to react-oidc’s signoutRedirect. For instance, in the context variant, changing logoutCallback to something like this:

  const logoutCallback = useCallback(async (args = {}) => {
    try {
      onLogout();
      await logoutUserInt(userManager, args);
      oidcLogInt.info('Logout successfull');
    } catch (error) {
      onError(error.message);
    }
  }, [logoutUserInt, oidcLogInt, onError, onLogout, userManager]);

and logoutUser in oidcServices.ts to something like this:

export const logoutUser = async (userManager: UserManager, args) => {
  if (!userManager || !userManager.getUser) {
    return;
  }
  const oidcUser = await userManager.getUser();
  if (oidcUser) {
    oidcLog.info('Logout user...');
    await userManager.signoutRedirect(args);
  }
};

would enable leveraging of state. That’s obviously a rough, not very Typescripty example, but it is the sort of thing I am envisioning.

Being able to pass state through would allow us to take different actions on the way back into the application based on how the user was logged out. For example, we could opt to show a warning on the screen if they were logged out programmatically rather than by user action.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
youf-oliviercommented, Mar 24, 2021

Hello. You just have to make a PR from a fork. We can’t add you in the contributors because of internal Axa Policies.

But don’t worry it’s very simple to contribute from a fork.

1reaction
rahul-sharma-uipathcommented, Mar 23, 2021

@guillaume-chervet @youf-olivier do you mind if I open a PR for this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

External IDP logout parameters - Microsoft Q&A
Hello,. We are using a custom policy in Azure B2C with Technical Profiles defined for each of our external IDPs. Log in is...
Read more >
Add logout with OIDC to application | Asgardeo Docs - WSO2
The logout endpoint is used to terminate the user session at Asgardeo and to ... state Optional, The parameter passed from the application...
Read more >
User LogIn and LogOut for React | Back4app Guides
To build a User LogIn and LogOut feature using Parse for a React App. ... Let's now build the UserLogIn component in your...
Read more >
Configure Single Logout in app integrations | Okta
Single Logout (SLO) is a feature in federated authentication where end users can sign out of both their Okta session and a configured...
Read more >
Desktop Presence and Forced Logout - Finesse - Document
When the agent's current state is Talking, the Agent goes into Not-Ready – Force Not Ready state after the call ends. ... When...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found