繁体   English   中英

带有Salesforce的Ruby OAuth没有得到refresh_token

[英]Ruby OAuth with Salesforce not getting refresh_token

我似乎一经获得授权就无法获得refresh_token,我尝试设置标头,有点像用谷歌oauth来完成,但不走运。 这是我的过程:

使用oauth2 gem

实例化客户端

client = OAuth2::Client.new(
  salesforce_app_key,
  salesforce_secret_key,
  site: 'https://login.salesforce.com/services/oauth2/',
  authorize_url: 'https://login.salesforce.com/services/oauth2/authorize',
  token_url: 'https://login.salesforce.com/services/oauth2/token',
  raise_errors: false
)

授权连接

auth = client.auth_code.authorize_url(
  redirect_uri: 'https://my_app_callback.com/oauth/authorize'
)

获取令牌

token = client.auth_code.get_token(
  code,
  redirect_uri: 'https://my_app_callback.com/oauth/authorize'
)

从这一点来说,我已经设置了连接,但是当我做token.refresh_token我得到一个nil值。

通过使用:

access_token = OAuth2::AccessToken.new(oauth, token)

会话已成功重新建立。 它在文档中,但没有以我能理解的方式编写,用于重新认证。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM