afraid-scarlet
afraid-scarlet3mo ago

Whomai unauthorised issue

@kapa.ai I have an error showing in the console "http://localhost:5001/api/sessions/whomai" 401 unauthorised, why am facing this issue?
5 Replies
kapa.ai
kapa.ai3mo ago
Hi @moabuessa. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The 401 unauthorized error typically occurs when the server receives a request that lacks valid authentication credentials. In the context of Refine, this could happen if the checkAuth function in your authProvider is rejecting the promise for unauthorized users. This is expected behavior, but it should not appear as an error in the console. Here's an example of how the checkAuth function might be implemented:
checkError: (error) => {
if (error.status === 401) {
return Promise.reject();
}
return Promise.resolve();
},
checkError: (error) => {
if (error.status === 401) {
return Promise.reject();
}
return Promise.resolve();
},
In this example, if the server returns a 401 status, the checkAuth function rejects the promise, indicating that the user is not authenticated. However, if you're seeing this error in the console, it might be due to the logging behavior of the @tanstack/react-query library, which logs failed queries/mutations in development mode for debugging purposes. This is not an issue with Refine or your code, and these logs will not appear in production mode. If you're still facing issues, please provide more context or consider checking the Refine documentation (https://refine.dev/docs/getting-started/overview) or asking for help in the Refine community (https://discord.gg/refine). Sources: - Github Issue (closed): [BUG] It will get a undefined error when startup > Comments Part 1 (https://github.com/refinedev/refine/issues/2608) - Github Issue (closed): [BUG] @pankod/refine-nhost is not handling graphQL error responses > Comments Part 3 (https://github.com/refinedev/refine/issues/1794) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@837327632001007678> kapa.ai is still learning and improving, please let us know how it did by reacting below
afraid-scarlet
afraid-scarlet3mo ago
@kapa.ai what is issue with whomai
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The term "whomai" doesn't appear in the provided knowledge sources. It seems like there might be a typo. If you're referring to a specific function or endpoint in your application, could you please provide more details? In the meantime, you might find it helpful to review the Refine documentation (https://refine.dev/docs/getting-started/overview) or ask for help in the Refine community (https://discord.gg/refine). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@837327632001007678> kapa.ai is still learning and improving, please let us know how it did by reacting below