Can't refetch Auth
I'm not sure if this is a refine or react problem, but the Router Provider keeps thinking I'm unauthenticated, but I'm not. Below is my code:
Any ideas?
14 Replies
harsh-harlequinโข3y ago
Hey @geekdev, sorry to hear you're having an issue. I'm checking now and trying to have a reproduction.
wee-brownOPโข3y ago
Btw, the user is not authenticated when reaching the page, but the mutate is supposed to create a session so the checkAuth is successful
Hey @geekdev ๐,
Could you share your checkAuth function?
wee-brownOPโข3y ago
๐ as you can guess, I'm connecting to Appwrite
Could you try as in our example ๐
https://github.com/refinedev/refine/blob/next/examples/dataProvider/appwrite/src/App.tsx#L40
GitHub
refine/App.tsx at next ยท refinedev/refine
Build your React-based CRUD applications, without constraints. - refine/App.tsx at next ยท refinedev/refine
wee-brownOPโข3y ago
btw,
await account.get();
will either return the session
or throw an exception...so that return Promise.reject();
will never be called
but i have tried your suggestion and it's the same resultThis code confused me. Can you explain a little bit? ๐
wee-brownOPโข3y ago
Appwrite uses teams for group permissions. A user can invite another user to a team and they'll get an email with a link that includes a secret. This page handles that link and calls the update team membership status API (the mutate call). That API call will also create a session
Oh I got it. As a workaround you can manually invalidate the state
https://github.com/refinedev/refine/blob/next/packages/core/src/contexts/auth/index.tsx#L18
Also could you create a GitHub issue? We'll fix it monday ๐
wee-brownOPโข3y ago
https://github.com/refinedev/refine/issues/3019
thank you! ๐
GitHub
[BUG] Can't refetch Auth ยท Issue #3019 ยท refinedev/refine
Describe the bug My app has another way to authenticate the user outside of the authProvider's login method. After successfully logging in without the authProvider, I try to call refetch() ...
wee-brownOPโข3y ago
this worked! Thanks! now I need to figure out why my mutate is being fired twice... ๐
GitHub
[BUG] Request api two times ยท Issue #2978 ยท refinedev/refine
Describe the bug When requesting API, always request API two times Steps To Reproduce Open firebug Network Open posts list: https://zzmiwzvxm--github--3000.local.webcontainer.io/posts => req...
Maybe could help ๐
wee-brownOPโข3y ago
Thanks! Weird react ๐