Replies: 3 comments
-
@nicojmb Thank you for sharing this driver. I know people have been looking for this. |
Beta Was this translation helpful? Give feedback.
-
I've just came here as I was looking for a solution myself.
In addition, to enhance security the EDIT |
Beta Was this translation helpful? Give feedback.
-
I also want to share my quick and dirty way to also fetch the users avatar. Please improve the code as needed. try {
$photo = $this->client->request('GET', 'https://graph.microsoft.com/v1.0/me/photos/48x48/\$value', [
'headers' => [
'Authorization' => 'Bearer ' . $this->getToken(),
],
'http_errors' => false,
]);
} catch (Exception $e) {
die($e->getMessage());
}
try {
$photoMeta = $this->client->request('GET', 'https://graph.microsoft.com/v1.0/me/photos/48x48', [
'headers' => [
'Authorization' => 'Bearer ' . $this->getToken(),
],
'http_errors' => false,
]);
} catch (Exception $e) {
die($e->getMessage());
}
$body = $photo->getBody();
$base64 = base64_encode($body);
$meta = json_decode($photoMeta->getBody(), true);
$mime = $meta['@odata.mediaContentType'];
$img = ('data:' . $mime . ';base64,' . $base64);
$userInfo->avatar = $img; And uncomment the commented out code in the EDIT |
Beta Was this translation helpful? Give feedback.
-
Hi all,
I've added a Microsoft OAuth service and i would like to share with community.
I take this opportunity to request that it be made configurable whether or not new users can be registered
Here are de code :)
config file: App\Config\ShieldOAuthConfig.php
library file: App\Libraries\ShieldOAuth\MicrosoftOAuth.php
Beta Was this translation helpful? Give feedback.
All reactions