我是 oauth 的新手,我正在尝试在 Rails 中设置 oauth2。但是每当我运行 rails s
时,我都会得到。
Couldn't get a file descriptor referring to the console
Enter the code returned in the URL:
我安装了 gem 并将此代码添加到/config/application.rb
require 'oauth2'
redirect_uri = 'my.herokuapp.com/callback'
client = OAuth2::Client.new('eeeeeeeee', 'aaaaaaaaaa', site: 'https://coinbase.com')
`open "#{client.auth_code.authorize_url(redirect_uri: redirect_uri)}"`
print "Enter the code returned in the URL: "
code = STDIN.readline.chomp
token = client.auth_code.get_token(code, redirect_uri: redirect_uri)
puts JSON.parse(token.get('/api/v1/account/balance').body)
我在本地运行它并指向我的 herokuapp。我究竟做错了什么? I'm follwing the tutorial on this page.
最佳答案
Rubygems 上的 gem 版本是 pre 2.0,具有 OAuth
使用 gem 'coinbase', :git => 'git://github.com/coinbase/coinbase-ruby.git'
关于ruby-on-rails - Rails 为 coinbase 设置 oauth2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20674312/