gpt4 book ai didi

ruby-on-rails - Rails 为 coinbase 设置 oauth2

转载 作者:太空宇宙 更新时间:2023-11-03 16:51:24 25 4
gpt4 key购买 nike

我是 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'

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

关于ruby-on-rails - Rails 为 coinbase 设置 oauth2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20674312/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com