【发布时间】:2014-01-07 14:03:19
【问题描述】:
我是 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.
【问题讨论】:
-
我现在正在尝试这样做,希望有更多关于该主题的文档。
-
你想做什么我可以帮忙
-
这有点复杂,所以今晚我不会再研究它了。我正在开展一个项目,其中“主机”设置“rsvp”价格,用户以 btc 支付价格。但是需要有一个托管功能,所以如果不满足某些条件,钱就会退还给用户。看看这个 repo:github.com/justuseapen/party_starter 抱歉缺少自述文件。
标签: ruby-on-rails ruby oauth oauth-2.0