1

I'm looking to integrate Microsoft Graph API into my ASP.NET core mvc solution. The thing is my app is hosted on Azure, I've know the appID aswell as the secretID, and the permissions are Ok on Azure.

I don't find any documentation on how to add the authentication to Graph at the same time as the already existing authentication to my website. I already tried to get access by getting an access token doing a POST request but it doesn't seem to be the better way to do it.

Some tips for me ?

7
  • Not sure what you mean by "integrate" but if you want to authenticate using facebook, did you follow this tutorial? Commented May 23, 2018 at 12:16
  • If you want to call facebook graph api within your application, I think there is a facebook sdk in c# with built in helpers/clients Commented May 23, 2018 at 12:19
  • @Nerevar Actually looking at it ty but I speak about Microsoft Graph developer.microsoft.com/en-us/graph/docs/concepts/overview Commented May 23, 2018 at 12:26
  • Ah sorry I thought facebook graph My bad, mention it in your question it could be confusing Commented May 23, 2018 at 12:27
  • You're right, gonna edit it Commented May 23, 2018 at 12:29

1 Answer 1

1

I don't find any documentation on how to add the authentication to Graph at the same time as the already existing authentication to my website.

You could follow this tutorial about using OpenID Connect middleware and the Active Directory Authentication Library (ADAL) for AD v1.0 endpoint.

Note: You need to set the required permissions for your AAD app to access Microsoft Graph API on Azure Portal,then change the GraphResourceId under appsettings.json to https://graph.microsoft.com/, and change the related request endpoint and parameters for accessing user profile under UserProfileController.cs.

Also, you could follow Microsoft Graph Connect Sample for ASP.NET Core 2.0 for Azure AD v2.0 endpoint.

Additionally, you could leverage the built-in Authentication and authorization in Azure App Service and follow Configure your App Service app to use Azure Active Directory login without manually add authentication middleware in your code. Then you could retrieve tokens in your app code, details you could follow here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.