active-directory
active-directory copied to clipboard
How can I use the access token to call the the Microsoft graph api?
Hi, I have a piece of code here:
$email = "{
Message: {
Subject: 'Sent using the Microsoft Graph REST API',
Body: {
ContentType: 'text',
Content: 'This is the email body'
},
ToRecipients: [
{
EmailAddress: {
Address: '[email protected]'
}
}
]
}}";
$response = $client->request('POST', 'https://graph.microsoft.com/v1.0/me/sendMail', [
'headers' => [
'Authorization' => 'Bearer ' . $entity->getAccessToken(),
'Content-Type' => 'application/json;odata.metadata=minimal;odata.streaming=true'
],
'body' => $email
]);
How can I use the access_token token provided by the magium and send an email? Please let me know.