Authorization_IdentityNotFound error MS Graph API

前端 未结 1 1284
慢半拍i
慢半拍i 2021-01-27 11:48

Our application is going to do simple User.ReadBasic.All functions, which from what I understand do not require Admin permissions. Using the flow documented here: https://graph

相关标签:
1条回答
  • 2021-01-27 12:16

    which from what I understand do not require Admin permissions.

    AFAIK,When using client credentials flow ,we need to set application permission to app , delegate permissions are used for delegated flow .

    You could try below code to get users using ADAL :

            string authority = "https://login.microsoftonline.com/a703965c-e057-4bf6-bf74-1d7d82964996";
            AuthenticationContext authenticationContext = new AuthenticationContext(authority, false);
            var result= await authenticationContext.AcquireTokenAsync("https://graph.microsoft.com", new ClientCredential("clientid", "clientsecret"));
    
    
            string sURL = "https://graph.microsoft.com/v1.0/users";
    
            WebRequest request1 = WebRequest.Create(sURL);
            request1.Method = "GET";
            request1.Headers.Add("Authorization", "Bearer " + result.AccessToken);
            HttpWebResponse response1 = (HttpWebResponse)request1.GetResponse();
            if (response1.StatusCode == HttpStatusCode.OK)
            {
                // some code
            }
    

    You could set "Read all users' full profiles" application permission for Microsfot Graph(for testing):

    0 讨论(0)
提交回复
热议问题