You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Supabase与SvelteKit注册新用户时出现PKCE flow认证错误

解决Supabase + SvelteKit注册时「PKCE flow is not supported on signups with autoconfirm enabled」错误

问题原因

这个错误的核心冲突在于:你开启了**自动确认用户(autoconfirm)**功能,同时使用了PKCE授权流程。Supabase的机制明确限制这两者不能同时启用。

解决办法

  • 关闭自动确认功能
    登录Supabase控制台,依次进入「Authentication」→「Settings」→「Email Auth Provider」,开启「Confirm email」选项(此操作等同于关闭autoconfirm)。用户注册后需要完成邮箱验证,PKCE流程即可正常运行。
  • 改用非PKCE认证流程
    若必须保留autoconfirm,可以在SvelteKit中初始化Supabase客户端时,指定使用隐式流程:
    import { createSupabaseClient } from '@supabase/auth-helpers-sveltekit';
    
    export const supabase = createSupabaseClient({
      supabaseUrl: import.meta.env.VITE_SUPABASE_URL,
      supabaseKey: import.meta.env.VITE_SUPABASE_ANON_KEY,
      auth: {
        flowType: 'implicit'
      }
    });
    
    注意:隐式流程存在安全风险,仅推荐在无法关闭autoconfirm的特定场景下使用。

内容的提问来源于stack exchange,提问作者HONjramiroz98

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 11:34:57