Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions src/MsGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,32 @@ class MsGraph
{
public function contacts(): Contacts
{
return new Contacts();
return new Contacts;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Styling.

}

public function emails(): Emails
{
return new Emails();
return new Emails;
}

public function files(): Files
{
return new Files();
return new Files;
}

public function sites(): Sites
{
return new Sites();
return new Sites;
}

public function tasklists(): TaskLists
{
return new TaskLists();
return new TaskLists;
}

public function tasks(): Tasks
{
return new Tasks();
return new Tasks;
}

protected static string $baseUrl = 'https://graph.microsoft.com/v1.0/';
Expand Down Expand Up @@ -83,7 +83,7 @@ public static function setUserModel(string $model): static
{
self::$userModel = $model;

return new static();
return new static;
}

/**
Expand Down Expand Up @@ -111,7 +111,15 @@ public function connect(?string $id = null): Redirector|RedirectResponse
}

if (! request()->has('code') && ! $this->isConnected($id)) {
return redirect($provider->getAuthorizationUrl());
$codeVerifier = bin2hex(random_bytes(32));
$codeChallenge = rtrim(
strtr(base64_encode(hash('sha256', $codeVerifier, true)), '+/', '-_'), '='
);

return redirect($provider->getAuthorizationUrl([
'code_challenge' => $codeChallenge,
'code_challenge_method' => 'S256',
]));
}

if (request()->has('code')) {
Expand Down
Loading