Supabase|解决 500 状态 Authentication 错误
了解如何排查 Supabase 详细的发生错误以及导致问题的具体原因。
在 Reports 中,能看到大量的 500 错误:

说明认证过程存在异常。
grant_type
grant_type 是 OAuth 2.0 协议中定义的一个标准参数,用于指定客户端请求访问令牌的授权方式。
常见 grant_type 包括:
authorization_code
:最常见的授权方式,用于传统的 Web 应用授权码流程。client_credentials
:客户端凭证模式,用于服务器到服务器的认证,不涉及用户,直接用客户端 ID 和密钥获取令牌。password
:资源所有者密码凭证模式,直接用用户名密码获取令牌。安全性较低,不推荐使用。refresh_token
:刷新令牌模式,用现有的 refresh_token 获取新的 access_token。id_token
:身份令牌模式(OpenID Connect 扩展),用于第三方身份验证(如 Apple Sign In、Google Sign In),直接用第三方提供的 id_token 换取应用的访问令牌。

Supabase 日志中的 grant_type 为 id_token
,和我们 Sign in with Apple 登录方式相符合:
- Apple 提供了一个 id_token(JWT 格式)
- 客户端将这个 id_token 发送给 Supabase
- Supabase 验证这个令牌并创建用户会话
错误排查
点击 Logs -> Auth 查看详细的错误日志:

这里可以看到详细的错误原因:

2025 年 6 月 11 日更新
Unhandled server error: oidc: issuer did not match the issuer returned by provider, expected \"https://appleid.apple.com\" got \"https://account.apple.com\"
上面这个问题,已经确认为 Supabase SDK 的问题,已经提交 Issue 给 Supabase 团队:
Sign in with Apple fails with 500 error due to Apple auth domain migration · Issue #732 · supabase/supabase-swift
Bug report I confirm this is a bug with Supabase, not with my own application. I confirm I have searched the Docs, GitHub Discussions, and Discord. Describe the bug When using Sign in with Apple, S…