Simple… I am trying to get the SAM account name field out of Azure using a call to Graph. I’ve already received the access token, and so I then make a call to graph using the “me” URL — https://graph.microsoft.com/v1.0/me, but what comes back never contains the specified field, and I’ve tried multiple spelling variations.
I’ve also decoded the access token, and it’s not in there either. This is the code I’m using:
<cfset apiUrl = "https://graph.microsoft.com/v1.0/me">
<cfscript>
graphqlQuery = '{
me {
displayName
mail
userPrincipalName
SAMAccountName
onpremisessamaccountname
}
}';
requestBody = {
query = graphqlQuery
};
</cfscript>
<cfhttp url="#apiUrl#" method="get" result="apiResponse" charset="utf-8" timeout="60">
<cfhttpparam type="header" name="Authorization" value="Bearer #cookie.at#">
<cfhttpparam type="header" name="Content-Type" value="application/json">
<cfhttpparam type="body" value="#serializeJSON(requestBody)#">
</cfhttp>```
Any idea what I'm doing wrong? Thank you for your help.