Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 获取无效的\u授权:身份验证失败_Ruby_Salesforce_Restforce - Fatal编程技术网

Ruby 获取无效的\u授权:身份验证失败

Ruby 获取无效的\u授权:身份验证失败,ruby,salesforce,restforce,Ruby,Salesforce,Restforce,我尝试通过restforce gem连接到salesforce。我使用next: client = Restforce.new(username: 'user@name.com', password: 'my_password', client_id: 'Consumer_Key', client_secret: 'Consumer_S

我尝试通过restforce gem连接到salesforce。我使用next:

client = Restforce.new(username: 'user@name.com',
                           password: 'my_password',
                           client_id: 'Consumer_Key',
                           client_secret: 'Consumer_Secret',
                           security_token: 'security_token',
                           api_version: '38.0',
                           grant_type: 'password',
                           ssl: {version: 'TLSv1'})
contacts = client.query("select ID__c from Contacts where Name = 'Lorem Ipsum'")
puts contacts.first
当我尝试执行它时,我会遇到下一个错误:
'authenticate!'无效\u授权:身份验证失败(Restforce::AuthenticationError)

在salesforce应用程序中,我设置:

  • 允许用户:所有用户都可以自行授权
  • 知识产权放宽:放宽知识产权限制
已使用启用和禁用的OAuth进行检查

我还尝试了简单的配置:

client = Restforce.new(username: 'user@name.com',
                       password: 'my_password',
                       client_id: 'Consumer_Key',
                       client_secret: 'Consumer_Secret',
                       api_version: '38.0',)
但也犯了同样的错误

已指定salesforce的有效凭据


我做错了什么?

你知道问题出在哪里了吗?我也遇到了同样的问题。我发现了我这边的问题:是IP关系设置问题。问题出在Salesforce这边。应用程序配置不正确。