Salesforce REST API 回调 URL 是否需要为 HTTPS?
我一直在尝试连接到 Salesforce REST API,但运气不太好。 Salesforce REST API 快速入门指南 指出需要 HTTPS 回调 url,但在他们使用的示例中https://localhost:8443/RestTest/oauth/_callback
作为回调 URL。
我尝试使用此 php Salesforce REST API 示例,但 Salesforce 似乎已经适应并进入了重定向循环。
如果我没有 SSL 证书,是否可以连接到 Salesforce REST API?如果可以,我该如何操作?根据记录,我的应用程序是用 PHP 编写的,而不是像大多数官方示例那样用 Java 编写。
I have been trying to connect to the Salesforce REST API but am not having very much luck.
The Salesforce REST API Quick Start Guide states that an HTTPS callback url is required, but then in the example they use https://localhost:8443/RestTest/oauth/_callback
as the callback url.
I tried connecting on my testing server (HTTP) using this php Salesforce REST API example, but Salesforce seems to have had a fit and entered a redirect loop.
Is it possible to connect to the Salesforce REST API if I do not have an SSL Certificate, and if so, how might I go about doing so? For the record, my application is written in PHP, not Java like most of the official examples are.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于 localhost,它接受 http,除了 localhost 之外,您应该使用 https。
但请求中的重定向 URI 和连接的应用程序中的回调 url 应匹配。
您可以在连接的应用程序和请求中使用
http://localhost:8080/
。For localhost it accepts http, and you should use https for other than localhost.
But the redirect URI in the request and the callback url in the connected app should get matched.
You can use
http://localhost:8080/<any_page_in_ur_project>
in both connected app and in request.我从未使用过 Salesforce REST API,但我已阅读您链接到的页面。
OAuth 回调 URL 必须是 HTTPS。您似乎自己在文档中发现了这一点:
...以及示例:
至于您的其他问题:
大概是通过第二种方法,正如您链接到的页面第一句话中提到的:
因此,只要您不处理其他人的密码(无论这意味着什么),您就可以使用
login()
获取会话 ID 并从那里与 Web 服务进行通信。I've never used the Salesforce REST API, but I have read the page you linked to.
The OAuth callback URL must be HTTPS. You seem to have discovered this yourself, both in the documentation:
...and the example:
As for your other question:
Presumably by the second method, as alluded to in the first sentence on the page you linked to:
So provided you aren't handling some else's password (whatever that means), you can use
login()
to get a Session ID and communicate with the web service from there.