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)
}}
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.