how to call graph api from api ? microsoft azure app registration

Viewed 171

i create api with help of app registration.

User.Read is default permission have.

i also have Application ID URI api://xxxxxxx

then i created my web api and use my configuration inside.

now i m using post mane to call my api and i just want to display my users data

inside my api with help of graph api.

so for postman what will be my scope as i dont have any custom scope.

so how my api will call ? graph api from inside my api end point?

how i can use my postman to test it ?

as i my api has specific end point like localhost/api/getuserdata

how this work ?

1 Answers

Answering your question, you need to create a AAD application with Graph(Read/write) Permission. So that when you use the Bearer token so the Graph manipulation access will be there as part of the scope of token.

In your case, your Api localhost/api/getuserdata will work as a wrapper around the Real Graph Api. i.e. your api should take the required payload to do any CRUD operation with GRAPH. then it should generate the bearer token(as explained in the above para). then it should call to your Graphclient.

coming to your query, what will be the scope of your bearer token from Postmane, it will be https://graph.microsoft.com/.default.

Related