繁体   English   中英

如何使用REST API获取Salesforce用户名?

[英]How to get Salesforce username using REST api?

我正在为oAuth和simple-salesforce REST api使用Web服务器流,以使用访问令牌和实例URL登录用户。 我已经浏览了http://www.salesforce.com/us/developer/docs/api_rest/index.htm文档,但找不到任何内容。

根据您的评论说您正在使用https://github.com/neworganizing/salesforce-oauth2 :您可以执行以下操作:

import urllib 

# After you get the code
response = salesforce_oauth_2.get_token(code)
print urllib.urlopen(response['id'])

get_token返回的json对象响应应包含一个id属性,该属性是一个url,您可以查询有关当前用户的更多信息。 有关更多详细信息,请参见此处 (第5段)。

让您的salesforce开发人员编写一种简单的方法,该方法在ping时将返回您要使用的上下文用户详细信息。 请参阅此处的示例。

暂无
暂无

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

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