microsoftgraph / msgraph-sdk-dotnet-auth

Archived - use the TokenCredential classes provided by Azure.Identity. https://docs.microsoft.com/en-us/dotnet/api/overview/azure/identity-readme
https://graph.microsoft.com
MIT License
78 stars 19 forks source link

Code: generalException Message: An error occurred sending the request. #85

Closed ghanshyambb closed 3 years ago

ghanshyambb commented 4 years ago

Inner Exception: Code: authenticationChallengeRequired Message: Authentication challange is required.

`IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder .Create(clientId). WithRedirectUri("https://login.microsoftonline.com/common/oauth2/nativeclient") .WithClientSecret(clientSecret) .WithAuthority("https://login.microsoftonline.com/organizations/") .Build();

string[] scope = new string[] {"Directory.AccessAsUser.All", "Directory.Read.All","Directory.ReadWrite.All" };

AuthorizationCodeProvider authProvider = new AuthorizationCodeProvider(confidentialClientApplication,scope); GraphServiceClient graphClient = new GraphServiceClient(authProvider); var directory = await graphClient.Directory.Request().GetAsync(); `

get directory give generalexception dont know what i am doing wrong any help for this? AB#7215

MIchaelMainer commented 4 years ago

You'll need to describe your scenario in more detail. Who are the actors? What is the nature of this application?

ghanshyambb commented 4 years ago

@MIchaelMainer i have created api application to get information of azure resources with all its property. i have registered my app in azure portal under active directory through which i will get all the resource information by different sdk now i want to get information of Active directory using graph sdk. i have use above code for authentication for active directory detail under my subscription.

maisarissi commented 3 years ago

Hi @ghanshyambb

Thank you for reaching out and opening this issue. This client library will not leave the preview state. Microsoft.Graph v4 now integrates with Azure.Identity which supports a wide variety of authentication flows out of the box. We suggest that you migrate to v4 + Azure.Identity. Read more about it in this issue.

This issue won't be fixed, and the repository will be archived.