【发布时间】:2016-11-24 18:59:39
【问题描述】:
我已经创建了 PayPal 商业账户,并且我已经在sandbox 模式下创建了应用程序。
通过使用PayPal-Ruby-SDK,我已将client_id、client_secret、username、password 和signature 添加到我的paypal.yml 文件中。
我也使用PayPal-Android-SDK,它有这个应用程序的client_id,当我的电话应用程序通过PayPal登录时,它会创建这种响应:
"response": {
"code":"mock_code_EJhi9jOPswug9TDOv93qg4Y28xIlqPDpAoqd7biDLpeGCPvORHjP1Fh4CbFPgKMGCHejdDwe9w1uDWnjPCp1lkaFBjVmjvjpFtnr6z1YeBbmfZYqa9faQT_71dmgZhMIFVkbi4yO7hk0LBHXt_wtdsw"
},
"client": {
"platform": "Android",
"paypal_sdk_version": "2.14.4",
"product_name": "PayPal-Android-SDK",
"environment": "mock"
},
"response_type": "authorization_code"
}
现在我想从这个code 字段生成refresh token。我把这个code 输入到我的 ruby 控制台中:
tokeninfo = Tokeninfo.create('mock_code_EJhi9jOPswug9TDOv93qg4Y28xIlqPDpAoqd7biDLpeGCPvORHjP1Fh4CbFPgKMGCHejdDwe9w1uDWnjPCp1lkaFBjVmjvjpFtnr6z1YeBbmfZYqa9faQT_71dmgZhMIFVkbi4yO7hk0LBHXt_wtdsw')
但是,这给我带来了这种错误:
PayPal::SDK::Core::Exceptions::BadRequest: Failed. Response code = 400. Response message = Bad Request. Response debug ID = 93403fd3eb431, 1998e13f9d984.
from D:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/paypal-sdk-rest-1.4.8/lib/paypal-sdk/core/util/http_helper.rb:135:in `handle_response'
from D:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/paypal-sdk-rest-1.4.8/lib/paypal-sdk/core/util/http_helper.rb:78:in `http_call'
from D:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/paypal-sdk-rest-1.4.8/lib/paypal-sdk/core/api/base.rb:86:in `api_call'
from D:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/paypal-sdk-rest-1.4.8/lib/paypal-sdk/core/api/base.rb:98:in `post'
from D:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/paypal-sdk-rest-1.4.8/lib/paypal-sdk/core/openid_connect.rb:71:in `create_from_authorization_code'
from (irb):3
from D:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7/lib/rails/commands/console.rb:110:in `start'
from D:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7/lib/rails/commands/console.rb:9:in `start'
from D:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7/lib/rails/commands/commands_tasks.rb:68:in `console'
from D:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from D:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7/lib/rails/commands.rb:17:in `<top (required)>'
我已在我的仪表板中选中使用 PayPal 登录选项。为什么会这样?
另外,我注意到这个mock_code_ 是相同的,每当我从不同的帐户登录时。
【问题讨论】:
标签: ruby-on-rails ruby paypal