googleworkspace / php-samples

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

Got "Required parameter is missing: response_type" when browsing url provide by quickstart.php #24

Closed marcebil closed 5 years ago

marcebil commented 6 years ago

I get credentials.json (attached credentials.zip) and I installed composer. Then I run "composer quickstart.php" provided in the PHP quickstart page (quickstart.php attached) I get this url to execute: (see phpquickstartOutput.jpg file attached)

https://accounts.google.com/o/oauth2/auth?%20response_type=code&access_type=offline&client_id=433334862655-7vdjqv2iaqhe452ekb8ib7t5hc2ujfqg.apps.go%20ogleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&state&scope=https%3A%2F%20%2Fwww.googleapis.com%2Fauth%2Factivity%20https%3A%2F%2Fwww.googleapis.com%2Fauth%20%2Fdrive.metadata.readonly&approval_prompt=auto

Expected Behavior

Actual Behavior

(See attached file BrowserError.jpg) I received this error: " Required parameter is missing: response_type response_type=code access_type=offline client_id=433334862655-7vdjqv2iaqhe452ekb8ib7t5hc2ujfqg.apps.go ogleusercontent.com redirect_uri=urn:ietf:wg:oauth:2.0:oob state= scope=https:/ /www.googleapis.com/auth/activity https://www.googleapis.com/auth /drive.metadata.readonly approval_prompt=auto "

Steps to Reproduce the Problem

with the attached composer.json file

  1. Run "php quickstart.php (as provide)"

Specifications

credentials.zip phpquickstartoutput quickstart.zip browsererror

asrivas commented 6 years ago

Which PHP quickstart is this for?

grant commented 6 years ago

It looks like the Drive Activity quickstart.

asrivas commented 6 years ago

In the quickstart.php you linked for us I noticed you added an additional scope + some code for Google_Service_Appsactivity and changed the Composer vendor directory path. I was able to get to the OAuth consent screen successfully with your edits except the vendor directory path and my credentials.

Can you confirm you're able to successfully the Drive PHP quickstart as is?

thabisomtolo commented 5 years ago

Hey guys Ireally need your help here i'm trying to connnect to google calendar API and all other poccess are working fine the problem start where im trying to enter a verification code from the link i get from the browser, please guys help me...

Fatal error: Uncaught exception 'GuzzleHttp\Exception\RequestException' with mes sage 'cURL error 60: SSL certificate problem: unable to get local issuer certifi cate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in W:\HawkMobileCE OMeetingsSite\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:186 Stack trace:

0 W:\HawkMobileCEOMeetingsSite\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory

.php(149): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Han dler\EasyHandle), Array)

1 W:\HawkMobileCEOMeetingsSite\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory

.php(102): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler \CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\ CurlFactory))

2 W:\HawkMobileCEOMeetingsSite\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler

.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlH andler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFa ctory))

3 W:\HawkMobileCEOMeeting in W:\HawkMobileCEOMeetingsSite\vendor\guzzlehttp\guz

zle\src\Handler\CurlFactory.php on line 186

marcebil commented 5 years ago

In the quickstart.php you linked for us I noticed you added an additional scope + some code for Google_Service_Appsactivity and changed the Composer vendor directory path. I was able to get to the OAuth consent screen successfully with your edits except the vendor directory path and my credentials.

Can you confirm you're able to successfully the Drive PHP quickstart as is?

Sorry for the delay and thanks to all the people who look at it. I just came back from an obligated rest. Answering to asrivas:

1) I just get again the last version of quickload.php from 'https://developers.google.com/drive/api/v3/quickstart/php'

2) I only change the directory where i installed the composer, modifying the require include directory. And it is loading fine.

3) Then I execute from the command line: 'php quickstart.php'
and get a link to browse to, which is: " https://accounts.google.com/o/oauth2/auth?%20response_type=code&access_type=offline&client_id=433334862655-7vdjqv2iaqhe452ekb8ib7t5hc2ujfqg.app%20s.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&state&scope=https%20%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly&prompt=select_account%20%20consent " 4) I browse to the link I am suppoused to get a verification code from there, or some OAuth screen, but instead I received a 400 error cod: "Error: invalid_request Required parameter is missing: response_type"

So, answering your question, i am not being able to get to the OAuth consent screen, as you do. (I had enabled the 'Drive Api' (getting the composer), and synchronized everything)

Any helps will be very welcome!

marcebil commented 5 years ago

If it helps I can upload my composer.json file

grant commented 5 years ago

We can't help if you modify the sample. Please use StackOverflow for generic questions Anu and I both couldn't find the issue you having, and it looks like the sample isn't being run as directed, so I'll close this issue.

If you still are finding an issue with this sample, please be very specific in a new issue.

Perhaps your credentials are incorrect. See issues like this: https://stackoverflow.com/questions/11696526/google-oauth-2-response-type-error-on-token-request