googleworkspace / php-samples

PHP samples for Google Workspace APIs
Apache License 2.0
288 stars 347 forks source link

classroom/quickstart/quickstart.php missing code #71

Closed emerika closed 3 years ago

emerika commented 3 years ago

When I run this code it complains that there is no callback URL -- which is correct.

This line is missing:

$client->setRedirectUri('SomeDomain/oauth2callback.php');

The second problem is there is no "quickstart" code to handle the callback.

Expected Behavior

To work

Actual Behavior

Fails because the code is broken

PHP Fatal error: Uncaught InvalidArgumentException: missing the required redirect URI in /home/.../public_html/gclassroom/vendor/google/auth/src/OAuth2.php:675 Stack trace:

0 /home/.../public_html/gclassroom/vendor/google/apiclient/src/Client.php(396): Google\Auth\OAuth2->buildFullAuthorizationUri(Array)

1 /home/.../public_html/gclassroom/test.php(48): Google\Client->createAuthUrl()

2 /home/.../public_html/gclassroom/test.php(73): getClient()

3 {main}

thrown in /home/.../public_html/gclassroom/vendor/google/auth/src/OAuth2.php on line 675

Steps to Reproduce the Problem

php test.php

Specifications