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

Fatal error in getDefaultScopes() #200

Open
theking2 opened this issue Sep 11, 2023 · 1 comment
Open

Fatal error in getDefaultScopes() #200

theking2 opened this issue Sep 11, 2023 · 1 comment

Comments

@theking2
Copy link

Fatal error: Uncaught TypeError: TheNetworg\OAuth2\Client\Provider\Azure::getDefaultScopes(): Return value must be of type array, string returned in /.../vendor/thenetworg/oauth2-azure/src/Provider/Azure.php:499

when calling $provider->getAuthorizationUrl();

@mark-unwin
Copy link

I got it working using the below. I took the tenant attribute from the Microsoft Entra Identifier in the Azure console for the app.

$provider->defaultEndPointVersion = TheNetworg\OAuth2\Client\Provider\Azure::ENDPOINT_VERSION_2_0;
$provider->tenant = '12345678-1234-1234-1234-123456789';
$baseGraphUri = $provider->getRootMicrosoftGraphUri(null);
$provider->scope = 'openid profile email offline_access ' . $baseGraphUri . '/User.Read';
$authUrl = $provider->getAuthorizationUrl(['scope' => $provider->scope]);
$_SESSION['oauth2state'] = $provider->getState();

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

2 participants