- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 omniauth-steam gem 通过 Steam 连接用户并检索用户的 ID64。我正在使用本地网络上的服务器运行 Ruby on Rails 5.0.1,该服务器运行 Apache 和Passenger。每当我尝试连接到/auth/steam 时,我都会通过“连接”按钮重定向到 Steam 网页(我已经登录)。当我单击该按钮时,我会收到一个错误页面,其中包含“invalid_credentials”消息。我已登录 Steam,可以毫无问题地浏览该站点。这条消息从何而来?我怎样才能解决这个问题?到目前为止,这是我的代码。
Omniauth 初始化器 :
# config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :steam, Rails.application.secrets.steam_web_api_key
end
skip_before_filter :verify_authenticity_token, :only => :auth_callback
def index
end
def auth_callback
auth = request.env['omniauth.auth']
session[:current_user] = {
:nickname => auth.info['nickname'],
:image => auth.info['image'],
:uid => auth.uid
}
redirect_to root_url
end
<p><%= link_to image_tag("http://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_large_noborder.png"), '/auth/steam' %></p>
get 'admin/index'
post 'auth/steam/callback' => 'admin#auth_callback'
root 'admin#index'
invalid_credentials
Extracted source (around line #25):
23 def raise_out!
24 fail(env['omniauth.error'] || OmniAuth::Error.new(env['omniauth.error.type']))
25
26 end
27
28 def redirect_to_failure
omniauth (1.3.1) lib/omniauth/failure_endpoint.rb:25:in `raise_out!'
omniauth (1.3.1) lib/omniauth/failure_endpoint.rb:20:in `call'
omniauth (1.3.1) lib/omniauth/failure_endpoint.rb:12:in `call'
omniauth (1.3.1) lib/omniauth/strategy.rb:479:in `fail!'
omniauth-openid (1.0.1) lib/omniauth/strategies/open_id.rb:80:in `callback_phase'
omniauth (1.3.1) lib/omniauth/strategy.rb:227:in `callback_call'
omniauth (1.3.1) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.3.1) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.3.1) lib/omniauth/builder.rb:63:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.0.1) lib/active_record/migration.rb:553:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:20:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.0.1) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.1) lib/rails/engine.rb:522:in `call'
/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:152:in `accept_and_process_next_request'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads'
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
最佳答案
事实证明,在这种情况下,这是因为运行脚本的服务器与 Steam 的服务器之间存在时差。我的服务器上的日期/时间有几分钟的时间,一旦我纠正了时间差异,错误消息就消失了,登录过程成功了。
关于ruby-on-rails - 使用 Steam OmniAuth gem 连接 Steam 的 OpenId 会出现 "invalid_credentials"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41290627/
我一直在查看 Steam API 文档,并且有许多服务提供 Steam 网上商店中游戏的信息,但它们似乎都需要游戏的 Steam ID 作为参数。这可以通过用户 ID 来完成,如果给定用户名,API
我正在尝试获取用户游戏统计数据。首先,我正在尝试这样做: http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?
我正在尝试在 Steam 上找到该项目的名称。 这是我目前从 json 数组中得到的 [appid] => 730 [contextid] => 2 [assetid] => 4981322842 [
我正在开发一个使用公共(public) Steam API 来收集一些信息的应用程序。 目前我通过调用GetPlayerAchievements (v0001)检索成就和通话总时长 GetOwnedG
是否可以使用 Steam API 获取 Steam(753) 或 CsGo(730) 完整背包/库存? 我找到了一个 API,我可以在其中获取 Dota2(570) TF2(440) 的完整背包/元素
我正在尝试获取 JSON 格式的买卖订单,例如价格历史记录,但找不到任何信息。有没有办法做到这一点? Buy and Sell orders screenshot 我尝试过: https://stea
我搜索了论坛,找到了获取所有用户游戏的示例模式: http://steamcommunity.com/id//games?tab=all&xml=1 返回所有游戏。但是,如果用户尚未设置 Steam
我一直在阅读论坛并尝试 Steam API,我正在寻找提供所有 Steam 游戏的 API。 我找到了提供所有 SteamApps 的 API,以及提供应用程序信息的 Steam 商店 API(我正在
Steam 为我们提供了交易相关的API,但没有具体的地址示例:https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService#
Steam 为我们提供了交易相关的API,但没有具体的地址示例:https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService#
我正在尝试使用 Google 日历跟踪我的游戏时间/历史记录。 这是 Steam Web API在其中我找不到一种方法来获取关于我究竟在什么时候玩什么的详细信息,除了 GetRecentlyPlaye
如何使用 Steam API(已启动并运行)获取我的应用程序中当前使用(登录)帐户的 Steam 用户名。 Steam ID 可以(例如)通过以下方式获得: CSteamID id = SteamUs
有很多网站,例如www.tf2outpost.com和 www.bazaar.tf用户可以通过单击按钮添加其他 Steam 用户。你到底是如何做到这一点的? Web API 中没有任何内容向您展示如何
我使用此 URL 在 CS:GO 容器中一次获取 100 个结果。我用 {currency} 代替 3,用 {start} 代替 100 的倍数,我的问题是 currency=3 code> 似乎不是
我在 Steam API 中搜索发送 Steam 报价的方法,但找不到。可以使用 API 或者您知道其他方法吗?我想在 PHP/Symfony 中使用它。 最佳答案 您目前无法通过 API 创建交易报
我想知道有没有办法让用户输入他们的“Steam 用户名”,然后您就可以找到他们的“SteamID”。我一直在查看“Steam API”,但没有找到任何相关信息。 我的想法是让用户将他们的“Steam
是否有 API 可以获取用户的 Steam 集换式卡牌? 我对steam不太熟悉,但这个页面上好像没有。 https://developer.valvesoftware.com/wiki/Steam_
steam 桌面快捷方式 steam:// 实际如何工作? 它们的 URL/目标类似于:“steam://rungameid/717”我知道类似的东西,比如“ftp://mynetworkadress
是否有 API 可以获取用户的 Steam 集换式卡牌? 我对steam不是很熟悉,但是这个页面好像没有。 https://developer.valvesoftware.com/wiki/Steam
steam 桌面快捷方式 steam:// 实际如何工作? 它们的 URL/目标类似于:“steam://rungameid/717”我知道类似的东西,比如“ftp://mynetworkadress
我是一名优秀的程序员,十分优秀!