如何在Vercel中使用Firebase进行Google身份验证?

huangapple go评论59阅读模式
英文:

How to use google authentication with firebase in vercel?

问题

我使用next.js、react和firebase创建了一个项目。我的网站的核心功能之一是通过firebase进行身份验证,在按钮点击时创建一个弹出窗口以使用Google登录。这个弹出窗口在我的本地主机上运行良好,但在我vercel托管的网站中测试该功能后,弹出窗口只保持打开不到一秒钟就关闭了。我没有进行任何更改以使身份验证与vercel配合,但我猜这是我必须实现的。我查找了一下,没有找到足够清晰的信息让我理解如何去做。有人能指导我吗?

英文:

I created a project using next.js, react and firebase. One of the core features of my website is authentication which works through firebase, creating a popup to sign in with google on a button click. This popup works in my local host but after testing out the feature in my vercel hosted website, the popup stays open for less than a second and closes. I haven't made any changes to make authentication work with vercel but i'm guessing thats something I have to implement. I've looked around and haven't found anything clear enough for me to understand as to how I could go about this. Can anyone guide me?

答案1

得分: 1

在firebase控制台中查看一段时间后,转到身份验证,你应该会找到一个设置选项卡。在那个设置选项卡中,我不得不将提供的Vercel网址添加到授权域中。我只是想让这一点更清晰,因为我在互联网上找不到明确说明要这样做的信息。

英文:

After looking around for a while if you go in the firebase console then go to authentication you should find a settings tab. In that settings tab I had to add the provided vercel url in the authorized domains. I just wanted to make this more clear as I couldn't find anything on the internet explicitly saying to do this.

huangapple
  • 本文由 发表于 2023年4月4日 07:14:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75924365.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定