firebase - Facebook 授权不适用于 Firebase 身份验证
问题描述
我在我构建的聊天应用程序上进行了社交身份验证。Google auth 工作得非常好,但 Facebook auth 神秘地点击了另一个 URL,然后重定向回登录页面。我知道App id
和App secret
在 Facebook 的 firebase 身份验证中是正确的。当我只是在本地运行应用程序时http://localhost:3000
,它给了我这个错误:
我认为将它托管到一个安全站点https
可以解决这种情况,但现在它只是点击 url 并返回登录页面,控制台中没有记录任何错误。下面是处理登录的代码:
import React from 'react';
import { GoogleOutlined, FacebookOutlined } from '@ant-design/icons';
import 'firebase/app';
import { auth } from '../firebase';
import firebase from 'firebase/app';
const Login = () => {
return (
<div id='login-page'>
<div id='login-card'>
<h2>Welcome to Unichat!</h2>
<div
className='login-button google'
onClick={() =>
auth.signInWithRedirect(new firebase.auth.GoogleAuthProvider())
}
>
<GoogleOutlined /> Sign In with Google
</div>
<br /> <br />
<div
className='login-button facebook'
onClick={() =>
auth.signInWithRedirect(new firebase.auth.FacebookAuthProvider())
}
>
<FacebookOutlined /> Sign In with Facebook
</div>
</div>
</div>
);
};
export default Login;
这是测试 Facebook 登录的托管站点:https ://chatapplication.netlify.app
解决方案
推荐阅读
- ruby-on-rails - Rails capistrano-maintenance gem - 在维护时允许使用特定的 url
- css - 如何修复 NextJS 中的 CSS?
- bash - 从用户输入更改目录的 Bash 脚本
- java - 出现意外错误(类型=禁止,状态=403)。禁止
- angular - 使用 nginx 容器化 Angular 应用程序“没有这样的文件或目录”
- node.js - 是否可以运行重新启动不和谐机器人的 bash 脚本?
- elasticsearch - ElasticSearch - 无法加载超过 2.1 B 文档的索引
- image - 如何解决 Mat RIO 断言失败错误
- file - 使用 perl 搜索和替换文件中的某些文本部分
- java - Java 8 到 11 升级 powermock 问题