-
Would like to implement remix auth in a remix project that works as an api for a mobile app like react native or flutter. is there some example of implementing renix auth on a client? I assume jwt tokens are used and stored on the remix side then mobile client gets a token back or how does it work?🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Remix Auth depends on the Remix's sessions, which at the same time uses cookies either to store the whole session data or to store a session ID. In a mobile app there's no cookies, and while you could send the Cookie header yourself, it's not the normal. My recommendation is to don't use Remix Auth for an API, instead attach a token to each request using the Authorization header and then create a function that you can pass the request and can check if the header is set, there's a token and it's still valid. |
Beta Was this translation helpful? Give feedback.
Remix Auth depends on the Remix's sessions, which at the same time uses cookies either to store the whole session data or to store a session ID.
In a mobile app there's no cookies, and while you could send the Cookie header yourself, it's not the normal.
My recommendation is to don't use Remix Auth for an API, instead attach a token to each request using the Authorization header and then create a function that you can pass the request and can check if the header is set, there's a token and it's still valid.