问题标签 [omniauth]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
5 回答
4174 浏览

ruby-on-rails - OmniAuth Google OpenID WEBrick::HTTPStatus::RequestURITooLarge

我正在使用 OmniAuth 来允许用户使用他们的 Google OpenID 帐户登录。当我尝试使用 WEBrick 以开发模式登录时,出现 WEBrick::HTTPStatus::RequestURITooLarge 错误。当我将它部署到我的 rails 主机时,它工作正常。我应该使用不同的 Web 服务器来代替 WEBrick 吗?

0 投票
2 回答
288 浏览

ruby-on-rails - 为什么 OmniAuth 将请求传递到下一个中​​间件?

OmniAuth工作得很好,但我注意到在 Rails v2.3.6 应用程序中使用它时,它会将请求传递到下一个 Rack 中间件,即使它最终自己处理请求并使用重定向响应。

代码摘录:(来自Github

我的应用程序在通过/auth/provider请求后会引发异常并返回 404。用户看不到这一点,但ExceptionNotifier日志会看到。为了解决这个问题,我创建了另一个中间件,它只响应[200,{},[]]所有路径,如/auth/provider_name.

为什么 OmniAuth 将请求向下传递到中间件堆栈?

0 投票
3 回答
1116 浏览

ruby-on-rails - Rails 3 — Omniauth routing error, works on local but not on my server

I'm trying to use Omniauth to allow users to login to my Rails app using Facebook. Locally, omniauth automatically redirects the browser to Facebook for authentication using the following link:

<%= link_to "Sign in with Facebook", "/auth/facebook" %>

It redirects back as is expected (no callback error) and I am then able to log out.

The issue occurs when I try to upload my application to my server. For some reason Omniauth isn't kicking in and it doesn't do the redirect. Instead it just points the browser to a non-existant directory in my app (http://sharedchecklist.com/auth/facebook) and spits out this error:

Routing Error

No route matches "/auth/facebook"

I've done a lot of searching over the past few hours to try and figure out what the issue could be. I've made sure to changee the the site and canvas URLs to my app's address. It isn't an issue with callback.

It's almost like omniauth isn't there…</p>

Has anyone encountered this issue before? I'm fairly new to rails but I've been able to figure through any issues before which makes this one all the most frustrating.

If the url would help, here it is: http://sharedchecklist.com/

Thanks for any assistance you can offer.

0 投票
1 回答
188 浏览

ruby-on-rails - 将omniauth与另一个身份验证系统混合

我还没有找到一种方法来混合 OmniAuth 身份验证系统(顺便说一下)和普通身份验证系统(如 restful 身份验证)。

有这方面的信息吗?提前致谢!

0 投票
1 回答
776 浏览

ruby-on-rails - 使用 Rails Omniauth gem 和 Google OpenID 时如何不需要用户的电子邮件

我当前的 /config/initializers/omniauth.rb 文件包含:

当我通过谷歌登录到 /auth/google 时,谷歌报告:

DOMAIN 要求从您的 Google 帐户 EMAIL 中获取一些信息 - 电子邮件地址:NAME (EMAIL)

我的应用程序不需要用户的电子邮件,所以我想消除这个进入障碍。反正有没有消除这个要求。对于 Facebook,我发现我可以添加选项的“范围”属性,例如:

0 投票
2 回答
1639 浏览

ruby-on-rails - Omniauth:如何在运行时设置身份验证提供程序详细信息

我有一个可以从 2 个域访问的 rails 应用程序。Facebook 要求我为每个域注册一个 facebook 应用程序,并为每个域提供凭据。使用 Omniauth,我只能指定一组在应用程序启动时设置的凭据。但是,我需要根据请求的主机为 FB 提供不同的凭据。

这里有2个问题:

  1. 如何在运行时更改 facebook 的 Omniauth 凭据?
  2. 如何拦截对 facebook 的调用、检查域并相应地设置凭据?由于 Omniauth 使用机架中间件,前置过滤器将不起作用。

任何建议都非常感谢!

0 投票
1 回答
165 浏览

ruby-on-rails - Omniauth 不返回 Facebook 签到?

使用 Omniauth/facebook 进行身份验证后,签入似乎不包含在我从 request.env [“omniauth.auth”] 收到的数据哈希中,我已授权签入,并且在使用我的访问代码点击 url 时可以看到它们..

有人有什么想法吗?

0 投票
1 回答
1029 浏览

ruby-on-rails - Omniauth + windows live

how do I configure a new windows-live provider using omniauth?

I tried the following with no success:

and

0 投票
4 回答
1436 浏览

ruby-on-rails - 什么是让设计、omniauth 和谷歌工作的正确配置行?

我已经查看了文档,但我无法弄清楚我打算用来让 devise + omniauth + google 很好地协同工作的特定行。

该策略文件建议有一种简单的方法,但我找不到示例。

https://github.com/intridea/omniauth/blob/master/oa-oauth/lib/omniauth/strategies/google.rb

目前我在 devise.rb 初始化文件中使用下面的行。

但我很确定它是不完整的。

此外,我正在努力寻找我应该在哪里注册 google app id 和密钥。

提前致谢。格雷姆

0 投票
1 回答
225 浏览

ruby-on-rails - 使用 Rails 的omniauth 成功登录后保存评论对象

在用户通过omniauth(Twitter、Facebook 或OpenID)成功登录后,我希望rails 更新或存储评论。

  1. 一个(未登录的)用户填写评论表单。发布那个。
  2. 用户获得一个omniauth 页面,她可以在其中选择登录方法:Twitter、Facebook 或 OpenID。
  3. 一旦用户从 oAuth 成功返回,我想存储(或发布)评论。

我有这个工作,使用会话变量,但这不是非常线程安全的:如果用户在同一个会话中打开多个评论选项卡,它将中断。

我应该将评论以未发布状态保存到数据库中,并在返回后切换吗?如果是这样,如何知道如何切换正确的评论?问题类似于上述会话问题。

有没有办法简单地将评论对象与omniauth一起传递并在用户成功登录返回时将其接收回来?

或者我可以传递一些哈希字符串,我可以在成功返回后提取这些字符串?

编辑:完全重写以简化和澄清问题。