【问题标题】:Rails setup oauth2 for coinbaseRails 为 coinbase 设置 oauth2
【发布时间】: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


【解决方案1】:

Rubygems 上的 gem 版本是 pre 2.0,它有 OAuth

使用gem 'coinbase', :git => 'git://github.com/coinbase/coinbase-ruby.git'

另见:https://github.com/coinbase/coinbase-ruby/issues/38

【讨论】:

    猜你喜欢
    • 2013-11-19
    • 1970-01-01
    • 2020-03-16
    • 2018-01-29
    • 1970-01-01
    • 2015-08-09
    • 1970-01-01
    • 1970-01-01
    • 2017-04-21
    相关资源
    最近更新 更多