【问题标题】:Microsoft Teams - how to get auth-token for api callsMicrosoft Teams - 如何获取 api 调用的 auth-token
【发布时间】:2020-05-04 07:58:25
【问题描述】:

我正在使用 nodejs sdk v4 在 Ms Teams 中开发一个机器人,它使用 getPagedTeamMembers() 获取所有团队成员的列表,然后为每个成员 我想获取他们与机器人的对话 ID。 我找到了一种使用 api 调用“serviceUrl/in/v3/conversations”的方法,但我不知道如何获取此 api 调用的承载身份验证令牌。

【问题讨论】:

    标签: microsoft-teams


    【解决方案1】:

    您向 /token 身份平台端点发送 POST 请求以获取访问令牌:

    发布 https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token

    Host: login.microsoftonline.com
    Content-Type: application/x-www-form-urlencoded
    
    client_id={client_Id}
    &scope=https%3A%2F%2Fgraph.microsoft.com%2F.default
    &client_secret={client_secret}
    &grant_type=client_credentials
    

    您将获得访问令牌作为响应

    {
      "token_type": "Bearer",
      "expires_in": 3599,
      "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBP..."
    }
    

    请看Get access token

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-07-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多