unclear how to sign out without hooks
See original GitHub issueOur project was using AppAuth-JS
library before discovering this. It is much more succinct and sensible so thank you.
One of the challenges faced in using this library: we are using Apollo client to make GraphQL requests and we use a link to detect 401 errors. From the link, it’s not clear how one could trigger a signout redirect. Thus, as a workaround, a boolean flag needsSignoutRedirect
was created in our redux store which gets picked up by a React hook which performs the signout.
How can one halt all rendering while the page redirects though? If the network error reaches the query hook, the page will display an error message momentarily. Throwing an error in the link and catching it in the error boundary in order to halt the rendering cycles could prevent the hook from catching the needsSignoutRedirect
flag.
Issue Analytics
- State:
- Created a year ago
- Comments:12 (1 by maintainers)
Top GitHub Comments
Actually, I take that back. Two user managers should be able to operate next to each other as long as they aren’t racing with each other for certain global resources. I think the only instances where this may come up is when waiting for a popup window or silent iframe to respond.
You would have to create another UserManager, but I think providing an easy way of obtaining a handle to the context without creating a child component is the better solution here. UserManager instances don’t talk to each other, so some things would fall out of sync. This is kind of related to #292.
If you have time to open a PR adding an imperative handle to
AuthProvider
, I’d appreciate it!