-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Refine app created with CLI infinitely loads but goes to the login path and back to home path and login path then home path etc... #5988
[BUG] Refine app created with CLI infinitely loads but goes to the login path and back to home path and login path then home path etc... #5988
Comments
Hello @jackprogramsjp, I created a new project and it seems to be no issue. Can you please provide us your Also which browser are u using? you can use |
I have the same issue, using the next.js / supabase scaffold. I usually notice this functionality about one hour after I close the tab and come back to the project. I realize my issue is slightly different to the original issue because I'm using Supabase, but I believe it stems from the same bug. From debugging it looks like the reason is because
@alicanerdurmaz I can invite you to the project that you can use to debug if that helps? |
@alicanerdurmaz Changing the import { AuthBindings } from "@refinedev/core";
import { cookies } from "next/headers";
// ADDED
function decodeJWTPayload (token: string) {
return JSON.parse(Buffer.from(token.split('.')[1], 'base64').toString());
}
export const authProviderServer: Pick<AuthBindings, "check"> = {
check: async () => {
const cookieStore = cookies();
const auth = cookieStore.get("token");
// ADDED
let expiryTimestamp = auth?.value ? decodeJWTPayload(auth.value).exp * 1000 : Infinity
let isStoredTokenValid = Date.now() - expiryTimestamp <= 0
if (auth && isStoredTokenValid) {
return {
authenticated: true,
};
}
return {
authenticated: false,
logout: true,
redirectTo: "/login",
};
},
}; |
@mschinis I could reproduce the bug, thanks for the solutions. Your solution seems valid but I want to investigate more. I believe Supabase's SDK has more viable solutions https://supabase.com/docs/guides/auth/server-side/creating-a-client I will keep you informed. |
Hello again @mschinis and @jackprogramsjp I fixed the supabase auth provider and we will release the fix for You can find the finished project here keypoints:
Please feel free to let me know if you find any issues or if you have any suggestions for improvements to the code. |
Hi @alicanerdurmaz , thanks for the quick turnaround. I've implemented your changes in my project and I'll get back to you, once I do a thorough testing. In general, your approach make sense. Couple of quick comments:
|
I can confirm that your changes solve my issue, thank you @alicanerdurmaz |
Thanks! @mschinis. You are right, we need to await the |
Hello again @jackprogramsjp, we released a fix for appwrite. You can see changed files here. If you have any questions please feel free to ask. |
Describe the bug
When I run
pnpm dev
, and I go to thelocalhost
, it just keeps spamming/login
and then/
and then/login
etc. Check the gyazo gif.https://gyazo.com/ddf4cef3fa74d7d1665795d438f33fdd
Steps To Reproduce
Expected behavior
It should not be infinitely loading.
Packages
Additional Context
No response
The text was updated successfully, but these errors were encountered: