0

I previously used Microsoft.graph package to work with Graph API. Used client credentials to authenticate as an application and able to get site details and others also with below code snippet.

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var delta = await graphClient.Sites.Request

I want to get the same data by making the Http request and get response from it.

https://graph.microsoft.com/v1.0/sites

I have to call the above request to get the site details , How to get Auth token and get response from it?

  • May be this [POST](https://stackoverflow.com/questions/51690909/executing-post-request-for-microsoft-graph-api-to-add-members-to-an-ad-group) can help you. – Shiva Keshav Varma May 14 '21 at 04:32
  • Can you please help me to get the access token for authentication, I've registered the application in AzureAD @Shiva Keshav Varma – Nithish Kumar May 15 '21 at 05:14

1 Answers1

1

Before you can call graph API, you will have to register your app in Azure AD and you will then be able to call some APIs to get an access token to make authenticated requests. You can find here the documentation from microsoft https://learn.microsoft.com/en-us/graph/auth-v2-user to get an access token and call the API on behalf of a user, or you can make anonymous calls by following this one https://learn.microsoft.com/en-us/graph/auth-v2-service.

When you have a token, you can use it to call Microsoft Graph API (just be sure to have to correct rights for your registered app to call Graph API)