googleworkspace / php-samples

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

missing the required redirect URI #22

Closed omerkhanjadoon closed 5 years ago

omerkhanjadoon commented 6 years ago

i am getting the following error when i try to run quick.php (which is named as quickstart in google drive api docs) i have copy paste the exact code but getting the error when i run it from my command line

Error:

PHP Fatal error:  Uncaught InvalidArgumentException: missing the required redirect URI in C:\xampp\htdocs\dnew\vendor\google\auth\src\OAuth2.php:650
Stack trace:
#0 C:\xampp\htdocs\dnew\vendor\google\apiclient\src\Google\Client.php(339): Google\Auth\OAuth2->buildFullAuthorizationUri(Array)
#1 C:\xampp\htdocs\dnew\quick.php(26): Google_Client->createAuthUrl()
#2 C:\xampp\htdocs\dnew\quick.php(58): getClient()
#3 {main}
  thrown in C:\xampp\htdocs\dnew\vendor\google\auth\src\OAuth2.php on line 650

Fatal error: Uncaught InvalidArgumentException: missing the required redirect URI in C:\xampp\htdocs\dnew\vendor\google\auth\src\OAuth2.php:650
Stack trace:
#0 C:\xampp\htdocs\dnew\vendor\google\apiclient\src\Google\Client.php(339): Google\Auth\OAuth2->buildFullAuthorizationUri(Array)
#1 C:\xampp\htdocs\dnew\quick.php(26): Google_Client->createAuthUrl()
#2 C:\xampp\htdocs\dnew\quick.php(58): getClient()
#3 {main}
  thrown in C:\xampp\htdocs\dnew\vendor\google\auth\src\OAuth2.php on line 650

Specifications

erickoledadevrel commented 6 years ago

Did you download the credentials.json file using the button in the quickstart? Please check that it has an "installed" key at the root.

pradeep-savitr commented 6 years ago

I am getting the following error

any help appreciated.

Fatal error: Uncaught exception 'GuzzleHttp\Exception\RequestException' with message 'cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in C:\wamp64\www\gdsample\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:187
Stack trace:
#0 C:\wamp64\www\gdsample\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array)
#1 C:\wamp64\www\gdsample\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(103): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#2 C:\wamp64\www\gdsample\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#3 C:\wamp64\www\gdsample\vendor\guzzlehttp\guzzle in C:\wamp64\www\gdsample\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 187
erickoledadevrel commented 6 years ago

@uday-savitr - That is an unrelated issue. Please see the troubleshooting section for how to resolve it: https://developers.google.com/gmail/api/quickstart/php#troubleshooting

erickoledadevrel commented 5 years ago

Closing due to inactivity.

paulcanning commented 5 years ago

I have this same issue.

I have a credentials.json, but it does not has an 'installed' key in it. Also, I'm unsure if my json file is made correctly.

erickoledadevrel commented 5 years ago

Did you use the button on the quickstart page? It should ensure the correct settings are used.

inside83 commented 3 years ago

I used type 'Web browser' and got an error

PHP Fatal error: Uncaught InvalidArgumentException: missing the required redirect URI in /root/vendor/google/auth/src/OAuth2.php:675

https://developers.google.com/gmail/api/quickstart/php#troubleshooting says "This code requires an OAuth client ID of type Other" but 'Other' isn't offered as an option in the dropdown menu. image

timcamps commented 3 years ago

I used type 'Web browser' and got an error

PHP Fatal error: Uncaught InvalidArgumentException: missing the required redirect URI in /root/vendor/google/auth/src/OAuth2.php:675

https://developers.google.com/gmail/api/quickstart/php#troubleshooting says "This code requires an OAuth client ID of type Other" but 'Other' isn't offered as an option in the dropdown menu. image

Make sure you have added the Redirect URI in your Client-ID: image

Also don't forget to download and replace the credentials.json file after you have made any changes: image

okellojohnsilas commented 2 years ago

I used type 'Web browser' and got an error PHP Fatal error: Uncaught InvalidArgumentException: missing the required redirect URI in /root/vendor/google/auth/src/OAuth2.php:675 https://developers.google.com/gmail/api/quickstart/php#troubleshooting says "This code requires an OAuth client ID of type Other" but 'Other' isn't offered as an option in the dropdown menu. image

Make sure you have added the Redirect URI in your Client-ID: image

Also don't forget to download and replace the credentials.json file after you have made any changes: image

This was very helpful. Thanks a lot for this