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: Uncaught InvalidArgumentException #20

Closed
SamMalcolm opened this issue Aug 13, 2018 · 5 comments
Closed

Fatal error: Uncaught InvalidArgumentException #20

SamMalcolm opened this issue Aug 13, 2018 · 5 comments
Assignees

Comments

@SamMalcolm
Copy link

(Please search existing issues before creating a new one.)

Sample:

Expected Behavior

  • Fowarded to website to approve access to gapi

Actual Behavior

Terminal throws an error:
Fatal error: Uncaught InvalidArgumentException: missing the required redirect URI in /Users/e32398/Sites/composer_test/vendor/google/auth/src/OAuth2.php:650
Stack trace:
#0 /Users/e32398/Sites/composer_test/vendor/google/apiclient/src/Google/Client.php(339): Google\Auth\OAuth2->buildFullAuthorizationUri(Array)
#1 /Users/e32398/Sites/composer_test/quickstart.php(26): Google_Client->createAuthUrl()
#2 /Users/e32398/Sites/composer_test/quickstart.php(58): getClient()
#3 {main}
thrown in /Users/e32398/Sites/composer_test/vendor/google/auth/src/OAuth2.php on line 650

Steps to Reproduce the Problem

  1. Installed composer and composer packages
  2. created credentials in API console selecting server side access. Created user for credentials as project owner
  3. Copy php to quickstart.php and ran php quickstart.php

Specifications

  • PHP version (php -v): 7.1.7
  • OS (Mac/Linux/Windows): 10.13.1
@asrivas asrivas self-assigned this Aug 15, 2018
@asrivas
Copy link
Contributor

asrivas commented Aug 15, 2018

Which quickstart is this from?

@bshaffer
Copy link
Contributor

Hello! So you will need to set the redirect URI in your Google_Client instance before calling createAuthUrl. For example:

$client = new Google_Client();
$client->setRedirectUri('https://mywebsite.com/auth/callback');
$client->setAuthConfig('/path/to/service_account.json');
$url = $client->createAuthUrl();

@SamMalcolm
Copy link
Author

@asrivas PHP Quickstart for the google sheets api v4

@SamMalcolm
Copy link
Author

I had download an incorrectly configured crednetials.json file as i must have selected the wront prefrences. As suchh im closing this issue, thanks for your input @asrivas and @bshaffer

@asrivas
Copy link
Contributor

asrivas commented Aug 16, 2018

No worries, glad you figured it out!

sqrrrl pushed a commit that referenced this issue Jul 6, 2022
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

3 participants