To integrate with the Microsoft Graph API, we need to first get an access token.
Can we store the result of one REST call in a variable to be used on a second REST call?
I didn't test this code, as it would require getting an account on the Microsoft Graph platform, but something like this should work:
{%set token = "https://login.microsoftonline.com/TENANT/oauth2/v2.0/token" | callRest(
verb="post",
options= {
form:{
client_id:"CLIENT_ID",
scope:"https://graph.microsoft.com/mail.read",
refresh_token: "REFRESH_TOKEN",
grant_type: "refresh_token",
client_secret: "CLIENT_SECRET"
}
}
) | field("access_token") %}
{{"https://graph.microsoft.com/v1.0/me/" | callRest(
options= {
'auth': {
'bearer': token
}
}
) | dump(2)
}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.