Get auth token microsoft graph api

0
Hi all   This might be the wrong place to ask this but I need help. I am trying to implement this → (https://docs.microsoft.com/en-us/graph/auth-v2-user) in my mendix application. Basically I want to get an access token so that any user can call post and get requests. It’s very confusing and I’m not sure how to retrieve the responses exactly, I’m not even sure if this guide even works in mendix, does anybody know how to implement this exactly or has someone already done it maybe?   Thanks
asked
2 answers
0

Hi Lenny,

We've implemented this a few days ago. The basics is just 2 REST calls, a POST for retrieving your access token, and then you use this token as a header in following POST or GET requests.

 

First get the token with a REST POST, using the Location https://login.microsoftonline.com/{1}/oauth2/v2.0/token (where {1} is your tenantID). As requestcontent you can use:

'client_id=' + $ClientID +
'&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default
&client_secret=' + $Secret +
'&grant_type=client_credentials'

We configured the following Http Header:

You will get the following response structure:

You can then use the Access_token in the actual REST call you want to do as a HTTP header:

Note that the token can expire, so you will have to check if your token is still valid before doing the second call, if there is some time between them. The expires_In field shows in how many seconds the token will expiry, so it is useful to also store a creationdate.

Hope this helps.

 

Cheers,

Daan

answered
0

Hello everybody. I had the same problem, but I solved. In my case the problem was access the calendar.

 

Solution Steps :-
1. Please Add below two “scopes “ in metadata of Authentication.

“Calendars.Read”
“Calendars.ReadWrite”

2. once added please select on “ Selected Scopes” 

3. after that once you authenticate as user you will able to see your calendar in Microsoft pre-defined snippet , able to see your calendar also you can able to send invite , I have tested the functionality .

 

 

 

answered