Zoho API:获取发出请求的用户
Zoho API: Get the user that is making the request
我看到 Zoho APIs 为我们提供了获取各种用户信息的选项,但我找不到任何方法来获取有关当前发出请求的用户的信息。
OAuth2 安全 API 通常提供这样的端点,就像 Google or Twitter 那样。
在他们的 documentation 中有一些看起来像的东西:
https://www.zohoapis.com/crm/v2/users?type=当前用户
但随后他们的解释粉碎了所有希望:
CurrentUser - 获取当前 CRM 用户列表
有什么已知的方法可以做到这一点吗?
我亲自测试过这个,可以确认他们文档上的文字是错误的。
他们说:
CurrentUser - To get the list of current CRM users
但实际上,该端点每次确实 return 一个用户,即 oauth 令牌所属的用户。所以它不是 returning "a list of current CRM users",而是 "the currently logged in user" - 完全如您所愿。
所以你的直觉是正确的,那个终点将实现你想要做的事情。
这是正确的端点:https://accounts.zoho.com/oauth/user/info
它需要 aaaserver.profile.READ 范围。
示例响应:
{
"ZUID": 123123123123,
"First_Name": "Example",
"Last_Name": "Name",
"Display_Name": "Example Name",
"Email": "example@email.com"
}
我看到 Zoho APIs 为我们提供了获取各种用户信息的选项,但我找不到任何方法来获取有关当前发出请求的用户的信息。
OAuth2 安全 API 通常提供这样的端点,就像 Google or Twitter 那样。
在他们的 documentation 中有一些看起来像的东西:
https://www.zohoapis.com/crm/v2/users?type=当前用户
但随后他们的解释粉碎了所有希望: CurrentUser - 获取当前 CRM 用户列表
有什么已知的方法可以做到这一点吗?
我亲自测试过这个,可以确认他们文档上的文字是错误的。
他们说:
CurrentUser - To get the list of current CRM users
但实际上,该端点每次确实 return 一个用户,即 oauth 令牌所属的用户。所以它不是 returning "a list of current CRM users",而是 "the currently logged in user" - 完全如您所愿。
所以你的直觉是正确的,那个终点将实现你想要做的事情。
这是正确的端点:https://accounts.zoho.com/oauth/user/info
它需要 aaaserver.profile.READ 范围。
示例响应:
{
"ZUID": 123123123123,
"First_Name": "Example",
"Last_Name": "Name",
"Display_Name": "Example Name",
"Email": "example@email.com"
}