英文:
Supabase with Next.js 13 App Router OAuth not logging in
问题
每当我使用以下代码登录:
// twitch signin handler
const handleTwitchSignIn = async () => {
const { data, error } = await supabase.auth.signInWithOAuth({
provider: "twitch",
options: {
redirectTo: `${location.origin}/${lang}/auth/callback`,
},
});
};
// google signin handler
const handleGoogleSignIn = async () => {
const { data, error } = await supabase.auth.signInWithOAuth({
provider: "google",
options: {
redirectTo: `${location.origin}/${lang}/auth/callback`,
},
});
};
我没有收到任何应该重定向到/auth/callback
的“code”参数。
文档中似乎没有提及这一点。我看到cookie值是code-verifier,但url中缺少code本身。
英文:
Whenever I log in with
// twitch signin handler
const handleTwitchSignIn = async () => {
const { data, error } = await supabase.auth.signInWithOAuth({
provider: "twitch",
options: {
redirectTo: `${location.origin}/${lang}/auth/callback`,
},
});
};
// google signin handler
const handleGoogleSignIn = async () => {
const { data, error } = await supabase.auth.signInWithOAuth({
provider: "google",
options: {
redirectTo: `${location.origin}/${lang}/auth/callback`,
},
});
};
I don't get any "code" param back that is supposed to be redirected into /auth/callback
.
None of the doc seems to talk about this. I see the cookie value being the code-verifier, but the code itself is missing from the url.
答案1
得分: 2
在阅读了许多关于PKCE以及查看了auth-helper-nextjs
库的代码后,我花了好几个小时,但找不到正确的答案。
原来,你只需在Supabase控制台中添加一个重定向URL策略。
此外,你可以看到我的URL具有语言动态URL,因为启用了i18n。
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论