anyways i can make logout quicker ?
everything working fine but after 401 it takes too much to logout user
3 Replies
Hi @Tarang. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The delay in logging out the user after a 401 error might be due to the time it takes for the
onError
method to execute and return a response. In your onError
method, you're checking for a 401 or 403 status and then returning an object with logout: true
and redirectTo: '/login'
. This triggers the logout process.
However, if the status is 400, you're returning an empty object {}
. This might be causing some delay if the server is returning a 400 status. You might want to handle this case differently.
Also, ensure that your check
method is working correctly. This method is used to check the authentication status of the user. If the token is not found in the local storage, it returns an object with authenticated: false
and logout: true
, which should trigger the logout process.
Here's a reference to the logout
method in the authProvider
from the Refine documentation (https://refine.dev/docs/authentication/auth-provider#logout):
And the useLogout
hook:
If the delay persists, it might be due to other factors not directly related to the logout process, such as network latency or server response time.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@852840146495340564> kapa.ai is still learning and improving, please let us know how it did by reacting below
multiple-amethyst•8mo ago
@Tarang We need more information for this issue, there can be many reasons why something is slow 🤔
If you provide reproducible example, we would happy to debug