Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃挕 [REQUEST] - Enhance Logout Functionality #156

Closed
kleysonfiretail opened this issue May 16, 2024 · 2 comments
Closed

馃挕 [REQUEST] - Enhance Logout Functionality #156

kleysonfiretail opened this issue May 16, 2024 · 2 comments
Labels
question Further information is requested

Comments

@kleysonfiretail
Copy link
Contributor

kleysonfiretail commented May 16, 2024

Summary

The react-oauth2-code-pkce library currently lacks some functionalities that are common in similar libraries like auth0-react, which affects developers transitioning between these libraries. To bridge this gap, I propose the following enhancements:

  • PostLogout Callback: A callback function that is triggered after the logout process completes.
  • Additional Parameters for logOut(): Allow passing additional parameters to the logOut() method, akin to the login() method.
  • LogoutInProgress State: A new state indicator to signify when a logout operation is in progress, enhancing UI responsiveness.

Basic Example

Here are some basic examples of how these features could be implemented:

PostLogout Callback Example:

const authConfig: TAuthConfig = {
 // ... //
  postLogout: () => {
    console.log("Logout completed!");
    // Additional cleanup actions can be performed here
  }
};

Additional Parameters for logOut() Example:

const additionalParameters = {
  returnTo: '/home',
  customParam: 'value'
};
logOut(additionalParameters);

LogoutInProgress State Example:

const { logoutInProgress } = useAuth();

if (logoutInProgress) {
  return <div>Logging out...</div>;
}

Drawbacks

Complexity: Introducing these features could increase the complexity of the library's API, potentially making it harder to maintain and understand.

Scope Creep: Each new feature could lead to requests for more similar features, potentially diverting focus from the core functionality of the library.

Performance: Adding more features, especially state management like logoutInProgress, might impact the performance if not implemented efficiently.

@kleysonfiretail kleysonfiretail added the question Further information is requested label May 16, 2024
@soofstad
Copy link
Owner

Hi @kleysonfiretail
Thank you for the suggestions.
I think these are reasonable requests. Params to the login() is something I have though of doing for some time, just never heard anyone actually missing it.
PostLogoutCallback is also a nice feature. Easy enough to add, and fits well with the existing callbacks pattern.

Not sure how you would use "LogoutInProgress", as it is a synchronous function, with no state and redirect back and fourth involved. If you could give an example for when you would need this to help me understand, that would be great 馃檪

@soofstad
Copy link
Owner

Closing this in favor of the other 2 issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants