Cel*_*ial 5 javascript authentication firebase firebase-authentication
我已经尝试 firebase 提供的身份验证服务超过 2 周了。一切都工作得很好,直到昨天,我无法使用 facebook 身份验证提供商和 twitter 来让用户连接到我的网络应用程序。
\n\n我尝试注销并登录,删除了我的 Facebook 和 Twitter 应用程序,并使用其他帐户创建了其他应用程序,但问题仍然存在。
\n\n当我尝试使用他们在 github 上提供的之前可以运行的代码时,也出现了同样的问题。
\n\n奇怪的是,当我使用谷歌提供商或使用电子邮件和密码登录方法时,它工作正常。
\n\nPS:我确保在控制台中启用了提供程序。
\n\nconst signInWithFacebookButton = document.getElementById(\'signInWithFacebook\');\n\nconst auth = firebase.auth();\n\nconst signInWithFacebook = () => {\n\n const facebookProvider = new firebase.auth.FacebookAuthProvider();\n\n auth.signInWithPopup(facebookProvider)\n .then(() => {\n console.log(\'Successfully signed in\');\n })\n .catch(error => {\n console.error(error);\n })\n}\n\nsignInWithFacebookButton.addEventListener(\'click\', signInWithFacebook);\n
Run Code Online (Sandbox Code Playgroud)\n\n当我尝试使用 facebook 进行身份验证时出现错误消息:
\n\n{code: "auth/invalid-credential", message: "The supplied auth credential is malformed or has expired."}\n
Run Code Online (Sandbox Code Playgroud)\n\n当我尝试使用 twitter 进行身份验证时出现错误消息:
\n\n{code: "auth/invalid-credential", message: "Error getting request token: 403 <?xml version="1.\xe2\x80\xa6ode-project-fd88e.firebaseapp.com/__/auth/handler"}\n
Run Code Online (Sandbox Code Playgroud)\n
对于Twitter登录,错误码403表示客户端对该URL的访问被禁止。它会给出这样的错误,因为您必须将回调 URL(您的网站)列入白名单。
作为我们持续努力确保 Twitter 开发者平台安全的一部分,任何使用 Twitter 登录的开发者都必须在 Twitter 应用程序设置的白名单中明确声明其回调 URL,登录到您的应用程序仪表板后可以在应用程序仪表板中访问该 URL。 developer.twitter.com 上的 Twitter 帐户。这意味着,如果
callback_url
与 oauth/request_token 端点一起使用的参数未列入白名单,您将收到错误。
因此,在 Twitter 应用程序设置中,您必须添加您的 URL,例如
https://sitename.example.com/auth/twitter
,https://sitename.example.com/auth/twitter/callback
- 您想使用https://yourdomain.com?source=twitter作为回调 URL
- 将其添加到 Twitter 应用仪表板:https://yourdomain.com
- 在对 oauth/request_token 的调用中使用它:https://yourdomain.com?source=twitter。
请参阅此社区文章了解更多详细信息:- Twitter 回调 URL
归档时间: |
|
查看次数: |
17349 次 |
最近记录: |