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

Firebase Auth 是否无法正常兼容 Twitter API v2?

问题背景

你在使用Firebase JS库对接Twitter登录时触发403错误,错误信息如下:

index.js:1 FirebaseError: Firebase: Failed to fetch resource from 
https://api.twitter.com/1.1/account/verify_credentials.json?include_email=true, 
http status: 403, 
http response: {"errors":[
   {"message":"You currently have Essential access which includes access 
               to Twitter API v2 endpoints only. If you need access to this endpoint, 
                you’ll need to apply for Elevated access via the Developer Portal. 
                You can learn more here: 
                https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve","code":453}]}
问题原因
  • Firebase内置的Twitter身份验证逻辑,默认调用Twitter API v1.1版本的account/verify_credentials.json接口获取用户信息,该接口不在Twitter API v2的可用范围内。
  • 你的Twitter开发者账号当前为Essential基础访问权限,该权限仅允许调用Twitter API v2的所有端点,没有v1.1接口的访问权限,因此请求被拦截返回403错误。
解决方案
  • 方案一:申请Twitter Elevated进阶访问权限。在Twitter开发者平台为对应项目提交进阶权限申请,审核通过后即可获得v1.1接口的访问权限,无需修改现有Firebase相关代码即可正常运行。
  • 方案二:自行适配Twitter API v2的授权流程。不使用Firebase内置的Twitter登录方法,自行实现Twitter OAuth 2.0授权,调用v2版本的用户信息接口获取身份数据后,手动调用Firebase的signInWithCredential方法完成账号登录,无需申请进阶权限。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.24 20:06:08