本文介绍了Salesforce OAuth 2.0 API:使用在普通浏览器中启动的授权 URL 获取 refresh_token的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此页面中,提到 refresh_token 仅针对不以 HTTPS 开头或指向 salesforce 的回调 URL 返回.

In this page, it is mentioned refresh_token is returned only for callback URLs that do not start with HTTPS or point back to salesforce.

https://na5.salesforce.com/help/doc/en/remoteaccess_oauth_user_agent_flow.htm

但是,在 SF->setup->develop->remote application 创建页面中,它只需要以 HTTPS 开头的 URL 或像 abcd' 这样的任意字符串.

However, in the SF->setup->develop->remote application creation page it takes only URL starting with HTTPS or an arbitrary string like abcd'.

在浏览器中启动授权 URL(即 OAuth 授权)时,是否有获取 refresh_token 的技巧?

Are there any tricks to get the refresh_token when the authorization URL ( i.e., OAuth authorization) is launched in a browser?

我们希望使用 refresh_token 重新验证 access_token(当它过期时),而不必提示登录窗口.

We want to use refresh_token to revalidate access_token ( when it expires) without having to prompt the login window.

推荐答案

我们使用了错误的流程(用户代理流程).如果我们使用 WebServer flow,我们也会将 refresh_token 发送到 https: urls.

We were using the wrong flow( user-agent flow). If we use WebServer flow we get refresh_token sent to https: urls as well.

这篇关于Salesforce OAuth 2.0 API:使用在普通浏览器中启动的授权 URL 获取 refresh_token的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 08:40