【问题标题】:Authentication fails in databasedotcomdatabasedotcom 中的身份验证失败
【发布时间】:2012-08-09 02:23:18
【问题描述】:

我正在尝试采用 databasedotcom gem,但无法超越身份验证。这是我所做的(在安装 databasedotcom gem 之后):

  1. rails c(或 irb 然后需要 'databasedotcom')
  2. client=Databasedotcom::Client.new :client_id => 'foo', :client_secret=>'bar'
  3. client.ca_file = '/Users/tjiang/missioncontrol/tmp/ca-bundle.crt'
  4. client.verify_mode = OpenSSL::SSL::VERIFY_PEER
  5. client.authenticate :username=>'myusername', :password=>'mypassword'

所有凭据都在此过程中复制并粘贴,因此不会出现错误;证书在这里下载:http://certifie.com/ca-bundle/ca-bundle.crt.txt

我反复尝试了 Ruby 187 和 193 以及 Rails 内部和外部,但总是收到以下错误消息:

Databasedotcom::SalesForceError:来自 /Library/Ruby/Gems/1.8/gems/databasedotcom-1.3.0/lib/databasedotcom/client.rb:112:in 'authenticate' 的身份验证失败

我想知道我在这里错过了什么?特别是,我担心在 Salesforce 中创建远程访问时使用的回调 URL(我尝试了“oob”、“http://localhost:3000”和“https://www.salesforce.com”,但没有有什么不同)。

【问题讨论】:

    标签: salesforce databasedotcom-gem


    【解决方案1】:

    事实证明这是由于 databasedotcom 中的一个错误。当您使用用户名和密码进行身份验证时,它会将它们放入不带编码的 url 查询字符串中,并使用该 url 发布请求。因此,我的用户名中的加号将被解释为一个空格。

    解决方案:CGI::escape() 你的用户名和密码。

    【讨论】:

      猜你喜欢
      • 2014-01-24
      • 1970-01-01
      • 2017-11-27
      • 1970-01-01
      • 1970-01-01
      • 2022-01-11
      • 2014-05-23
      相关资源
      最近更新 更多