extended-salmon
extended-salmon5mo ago

Auth token is not being sended to backend

I've implemented this to get auth token from frontend to backend, but in backend it does not receive refine_auth in req.header:
2 Replies
kapa.ai
kapa.ai5mo ago
Hi @celu99. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided, it seems like you're having trouble sending the authentication token from the frontend to the backend. Here are a few steps you can follow to troubleshoot this issue: 1. Check your Auth Provider: Ensure that your auth provider is correctly implemented. The auth provider is responsible for handling the login, logout, and authentication check. You can refer to this example of an auth provider (https://refine.dev/blog/building-react-admin-dashboard#adding-the-auth-provider) for guidance. 2. Use Axios Interceptors: After obtaining the token, you can use Axios interceptors to include the token in the headers of all requests. This is mentioned in the Refine documentation (https://refine.dev/docs/guides-concepts/data-fetching#authentication-). 3. Check your Data Provider: Ensure that your data provider is correctly set up to use the authentication token. You can refer to this discussion on how to send headers in API requests (https://github.com/refinedev/refine/issues/4622) for more information. 4. Securely Store Tokens: If you're concerned about security, consider storing your tokens in cookies instead of local storage. You can refer to this discussion on how to handle node server tokens securely in Refine (https://github.com/refinedev/refine/discussions/5116) for more information. If you're still having trouble, please provide more information about your implementation, such as the code you're using to send the token and the backend setup. This will help in providing a more accurate solution. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5mo ago
<@655810325777481823> kapa.ai is still learning and improving, please let us know how it did by reacting below