【发布时间】:2020-11-26 21:32:18
【问题描述】:
Coinbase Connect (OAuth2) 允许用户为特定帐户或用户拥有的所有帐户授予对应用程序的访问权限。
选择取决于 OAuth2 授权 URL 上的帐户参数(默认值 = select 以授予对单个帐户的访问权限)。
我需要使用account=all
有谁知道我可以在 Devise 哪里设置这个?
我试过了:
在config/initializers/devise.rb:
config.omniauth :coinbase, ENV['COINBASE_CLIENT_ID'], ENV['COINBASE_SECRET_ID'], scope: 'wallet:user:email wallet:accounts:read wallet:payment-methods:read wallet:sells:create wallet:withdrawals:create', account: :all
但这并没有改变授权 URL
然后我尝试在app/views/pages/profile.html.erb的omniauth_authorize_path中添加参数
<button class="d-flex justify-content-between align-items-center pr-4 coinbase-btn">
<%= image_tag 'logo-coinbase-white.svg', class: "coinbase-logo" %>
<%- User.omniauth_providers.each do |provider| %>
<%= link_to "Connect your #{OmniAuth::Utils.camelize(provider)} Wallet",
omniauth_authorize_path(current_user, provider, account: 'all') %>
<% end %>
</button>
(这是我希望用户将他们的 coinbase 帐户与他们在我的应用程序上的帐户相关联的页面)
【问题讨论】:
标签: ruby-on-rails devise omniauth coinbase-api