简体   繁体   English

SalesForce OAuth响应中没有refresh_token

[英]No refresh_token in SalesForce OAuth Response

I'm interacting with a custom APEX service which obviously require OAuth authentication. 我正在与自定义APEX服务交互,显然需要OAuth身份验证。 I can easily authenticate and authorise my application. 我可以轻松验证和授权我的应用程序。 Everything works fine. 一切正常。

However, the access token I receive tends to expire. 但是,我收到的访问令牌往往会过期。

Of course, I can refresh it by sending a refresh_token. 当然,我可以通过发送refresh_token来刷新它。 Sounds great. 听起来不错。

The problem is I don't receieve a refresh_token in a response from SalesForce. 问题是我没有在SalesForce的响应中收到refresh_token。

I do send requests to [instance].salesforce.com/services/oauth2/token, I also tried to using login.salesforce.com/services/oauth2/token, but I cannot find 'refresh_token' in the response. 我发送请求到[instance] .salesforce.com / services / oauth2 / token,我也尝试使用login.salesforce.com/services/oauth2/token,但我在响应中找不到'refresh_token'。 There's everything apart from it there!.. 那里除了那里有一切!..

Please check Selected OAuth Scopes section, which is needed to be enabled Perform requests on your behalf at any time in order to get the refresh token. 请选中需要启用的选定OAuth范围部分,以便代表您随时执行请求以获取刷新令牌。

Сreate > Apps > API ( Enable OAuth Settings ) > Selected OAuth Scopes . Сreate > 应用程序 > API启用OAuth设置 )> 选定的OAuth范围

I've solved the problem thanks to my wonderful colleague. 我很好的同事,我已经解决了这个问题。

I should have added 'refresh_token' to the scope when retrieiving an auth code. 我应该在检索身份验证代码时向范围添加'refresh_token'。

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

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