doc example authentication #3253
Replies: 2 comments 1 reply
-
Generally speaking, all of that would be happening in your query fn. For example, in your login query function, you could put something in In other words, react query is not opinionated about how you handle this. |
Beta Was this translation helpful? Give feedback.
-
Maybe this link can help https://codevoweb.com/react-query-context-api-axios-interceptors-jwt-auth/ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to learn react query and the first thing I'm hitting is authentication where the user needs to register, activate account, login, logout and deregister. At the same time there is a dependency between the user state and being logged in or not.
I feel this case is not very straight forward and has elements like token persistence and token expiring plus refresh tokens that make it less obvious as how to deal with this proper using react query.
Given the frequent occurrence of authentication it would be great if an example or best practice would be included inside the examples section of the docs.
Beta Was this translation helpful? Give feedback.
All reactions