OmniAuth OAuth 2.0 Callback在Google Chrome中触发两次 [英] OmniAuth OAuth 2.0 Callback fires twice in Google Chrome

查看:217
本文介绍了OmniAuth OAuth 2.0 Callback在Google Chrome中触发两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个单页应用(位于 https://duggout.com ),其OAuth使用Google& amp ; Facebook的。回调函数使用OAuth代码 https://login.duggout.com 。它使用URL中的JWT令牌重定向到 https://duggout.com

I have a Single page app (at https://duggout.com) that has OAuth login with Google & Facebook. The callback goes to https://login.duggout.com with OAuth code. It redirects to https://duggout.com with JWT token in the URL.

我从Facebook和Facebook的回拨中得到一个问题。谷歌。该回调会被第二次触发,并被Chrome取消。请参阅下面的相同请求:

I get an issue with the callback from Facebook & Google. The callback is fired twice with the first one getting cancelled by Chrome. See the identical requests below:

< img src =https://i.stack.imgur.com/l7979.pngalt =omniauth oauth回调两次>

我可以

第一次请求:

I, [2017-07-29T09:43:32.911199 #8062]  INFO -- : [1663579f-41ea-4257-ab94-d51595154004] Started GET "/auth/facebook/callback?code=<OAUTH_CODE>&state=<OAUTH_STATE>" for 220.244.205.75 at 2017-07-29 09:43:32 +0000
302 to duggout.com with successful token

第二次请求(1秒钟后):

2nd request (1 second later):

I, [2017-07-29T09:43:33.548306 #8062]  INFO -- : [908cd618-83c3-4c96-92b8-7496642a1903] Started GET "/auth/facebook/callback?code=<OAUTH_CODE>&state=<OAUTH_STATE>" for 220.244.205.75 at 2017-07-29 09:43:33 +0000
302 to failure URL

第一个请求成功并发送302到浏览器。但是,因为它被浏览器取消,所以没有使用该响应。第二个请求因相同的OAuth代码已通过身份验证而失效。

The first request is successful and sends 302 to the browser. But because it is cancelled by the browser, that response is not used. The second request becomes invalid because of the same OAuth code authenticated already.

我发现这个

I found this thread that talks about the same problem but 3 years back.

我无法弄清楚这是不是一个问题Google& Google Chrome或OAuth配置Facebook或我的应用程序代码。它在Firefox中完美运行。 Firefox不做两次回调。

I couldn't figure out if this is an issue with Google Chrome or OAuth config in Google & Facebook or with my application code. It works perfectly in Firefox. Firefox doesn't make two callbacks.

推荐答案

我刚发现这与Chrome插件有关: Hola代理即可。删除插件后,第一个回叫请求不再取消。感谢这个 SO答案

I just found out that this is related to a Chrome Plugin: Hola Proxy. After removing the plugin, the first callback request is no longer cancelled. Thanks to this SO answer.

这篇关于OmniAuth OAuth 2.0 Callback在Google Chrome中触发两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆