ruby-on-rails - 在 Rails 上使用 Omniauth-steam 返回“提供的位置为零。无法构建 URI”
问题描述
我正在尝试使用https://github.com/reu/omniauth-steam但它给了我一个错误
'Nil location provided. Can't build URI'
我尝试按照https://grschafer.com/guides/2013/09/07/steam-openid-and-webapi-with-rails/中的教程进行操作,但我不确定它是否仍然是最新的。
我试着把
skip_before_action :verify_authenticity_token, :only => :auth_callback
从上面的链接或:
protect_from_forgery with: :null_session, if: Proc.new { |c| c.request.format == 'application/json' }
正如 2017 年 github 中的相关问题中所述,但它仍然无法正常工作
我的观点是这样的:
<% if session.key? :current_user %>
<h3>Current user:</h3>
<%= image_tag session[:current_user][:image] %>
<p><%= session[:current_user][:nickname] %></p>
<p><%= session[:current_user][:uid] %></p>
<% end %>
在会话转储中仍然有我需要的信息:
_csrf_token: "xxxxxxxxxxxxx"
current_user: {"nickname"=>"xxxxx", "image"=>"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/be/xxxxxxxxxxx_medium.jpg", "uid"=>"xxxxxxxx"}
解决方案
推荐阅读
- c# - Blazor EditForm 提交两次而不是一次
- c# - 发生索引超出范围异常
- reactjs - reactjs 正确使用函数和钩子 - 我收到错误
- mysql - 检查与您的 MySQL 服务器版本相对应的手册,以在第 1 行的 'identified by 'wordpress#demo'' 附近使用正确的语法
- javascript - TypeError:_this.props.loginState 不是函数
- python - 根据分箱输入计算百分位数
- android - 如何使用集合更新 Firebase Firestore 文档中的字段
- python - 查找属于列但不属于高阶列的对数
- internationalization - 如何将 pg_search_scope 与 Mobility 一起使用来翻译属性?
- python - 使用 Sprite 组时图像未在 Pygame 上显示