Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getResourceOwner fails with "Access token is empty" #12

Open
br4nnigan opened this issue Nov 5, 2024 · 0 comments
Open

getResourceOwner fails with "Access token is empty" #12

br4nnigan opened this issue Nov 5, 2024 · 0 comments

Comments

@br4nnigan
Copy link

br4nnigan commented Nov 5, 2024

Since you need the resource owner e-mail to use the token with say PhpMailer, it would be nice to obtain it automatically.

I would have expected that this works:

$authUrl = $provider->getAuthorizationUrl([
  'scope' => [
    'https://outlook.office.com/SMTP.Send',
    'offline_access',
    'https://outlook.office.com/User.Read' # <----added this
  ]
]);

...

$token = $provider->getAccessToken(
  'authorization_code',
  [
    'code' => $_GET['code']
  ]
);
$provider->getResourceOwner($token); 

The last line of the quote fails with "InvalidAuthenticationToken","message":"Access token is empty." Hardcoding the email the workflow works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant