Get team channels API returning 401 Unauthorized

%3CLINGO-SUB%20id%3D%22lingo-sub-1825408%22%20slang%3D%22en-US%22%3EGet%20team%20channels%20API%20returning%20401%20Unauthorized%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1825408%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20getting%20the%20following%20response%20while%20trying%20to%20fetch%20channels%20corresponding%20to%20a%20team%20using%20the%20Graph%20API.%20It%20was%20working%20fine%20few%20days%20ago%20but%20started%20failing%20recently.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fteams%2F%7B%7Bteam-id%7D%7D%2Fchannels%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fteams%2F%7B%7Bteam-id%7D%7D%2Fchannels%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%7B%0A%20%20%20%20%22error%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22code%22%3A%20%22Unauthorized%22%2C%0A%20%20%20%20%20%20%20%20%22message%22%3A%20%22Failed%20to%20execute%20Aad%20backend%20request%20GetUsersByObjectIdsRequest.%20Workload%20Unknown.%20Request%20Url%3A%20https%3A%2F%2Fgraph.windows.net%2Fmyorganization%2FgetObjectsByObjectIds%3Fapi-version%3D1.61-internal%2C%20Request%20Method%3A%20POST%2C%20Response%20Status%20Code%3A%20Unauthorized%2C%20Response%20Headers%3A%20ocp-aad-diagnostics-server-name%3A%20JniMij6yIQ%2B28j3rO74gZklFGwbp%2BnmK%2FbJ9wZpbrLU%3D%5Cr%5Cnrequest-id%3A%2081878619-142f-48fa-988a-d63b5dba490c%5Cr%5Cnclient-request-id%3A%20ff0e9916-dc45-4e77-b81e-1e6ffe99736c%5Cr%5CnStrict-Transport-Security%3A%20max-age%3D31536000%3B%20includeSubDomains%5Cr%5CnDate%3A%20Tue%2C%2027%20Oct%202020%2023%3A11%3A43%20GMT%5Cr%5Cn%2C%20Reason%20Phrase%3A%20Unauthorized%22%2C%0A%20%20%20%20%20%20%20%20%22innerError%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22date%22%3A%20%222020-10-27T23%3A11%3A44%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22request-id%22%3A%20%2244c3a289-d3d7-4638-9ea5-25796bd85693%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22client-request-id%22%3A%20%2244c3a289-d3d7-4638-9ea5-25796bd85693%22%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20using%20client_credentials%20grant%20to%20obtain%20the%20token%20with%20the%20following%20app%20permissions%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%22roles%22%3A%20%5B%0A%20%20%20%20%22TeamMember.Read.All%22%2C%0A%20%20%20%20%22Chat.UpdatePolicyViolation.All%22%2C%0A%20%20%20%20%22TeamsActivity.Read.All%22%2C%0A%20%20%20%20%22ChannelSettings.Read.All%22%2C%0A%20%20%20%20%22Channel.ReadBasic.All%22%2C%0A%20%20%20%20%22Group.Read.All%22%2C%0A%20%20%20%20%22Sites.ReadWrite.All%22%2C%0A%20%20%20%20%22Files.ReadWrite.All%22%2C%0A%20%20%20%20%22Directory.Read.All%22%2C%0A%20%20%20%20%22User.Read.All%22%2C%0A%20%20%20%20%22ChannelMember.Read.All%22%2C%0A%20%20%20%20%22GroupMember.Read.All%22%2C%0A%20%20%20%20%22Team.ReadBasic.All%22%2C%0A%20%20%20%20%22Chat.Read.All%22%2C%0A%20%20%20%20%22ChannelMessage.Read.All%22%2C%0A%20%20%20%20%22Chat.ReadWrite.All%22%2C%0A%20%20%20%20%22ChannelMessage.UpdatePolicyViolation.All%22%2C%0A%20%20%20%20%22Chat.ReadBasic.All%22%0A%20%20%5D%2C%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOther%20APIs%20to%20list%20teams%2C%20list%20teams%20members%20etc%20are%20working%20fine.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1825408%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%20API%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Visitor

I am getting the following response while trying to fetch channels corresponding to a team using the Graph API. It was working fine few days ago but started failing recently.

 

https://graph.microsoft.com/v1.0/teams/team-id/channels

 

 

 

{
    "error": {
        "code": "Unauthorized",
        "message": "Failed to execute Aad backend request GetUsersByObjectIdsRequest. Workload Unknown. Request Url: https://graph.windows.net/myorganization/getObjectsByObjectIds?api-version=1.61-internal, Request Method: POST, Response Status Code: Unauthorized, Response Headers: ocp-aad-diagnostics-server-name: JniMij6yIQ+28j3rO74gZklFGwbp+nmK/bJ9wZpbrLU=\r\nrequest-id: 81878619-142f-48fa-988a-d63b5dba490c\r\nclient-request-id: ff0e9916-dc45-4e77-b81e-1e6ffe99736c\r\nStrict-Transport-Security: max-age=31536000; includeSubDomains\r\nDate: Tue, 27 Oct 2020 23:11:43 GMT\r\n, Reason Phrase: Unauthorized",
        "innerError": {
            "date": "2020-10-27T23:11:44",
            "request-id": "44c3a289-d3d7-4638-9ea5-25796bd85693",
            "client-request-id": "44c3a289-d3d7-4638-9ea5-25796bd85693"
        }
    }
}

 

 

I am using client_credentials grant to obtain the token with the following app permissions:

 

 

 

"roles": [
    "TeamMember.Read.All",
    "Chat.UpdatePolicyViolation.All",
    "TeamsActivity.Read.All",
    "ChannelSettings.Read.All",
    "Channel.ReadBasic.All",
    "Group.Read.All",
    "Sites.ReadWrite.All",
    "Files.ReadWrite.All",
    "Directory.Read.All",
    "User.Read.All",
    "ChannelMember.Read.All",
    "GroupMember.Read.All",
    "Team.ReadBasic.All",
    "Chat.Read.All",
    "ChannelMessage.Read.All",
    "Chat.ReadWrite.All",
    "ChannelMessage.UpdatePolicyViolation.All",
    "Chat.ReadBasic.All"
  ],

 

 

 

Other APIs to list teams, list teams members etc are working fine. 

0 Replies