Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle API - request for token from Oauth2 returns “invalid_request”
    primarykey
    data
    text
    <p>I know this has been asked before, but the suggestions in other posts haven't helped. I successfully receive an authorization token from google, but when I try to get the access token, I get an invalid_request.</p> <p>Our first attempt in PHP resulted in that response, when I tried it through my HTTP client, I get the same. Finally, I tried directly with CURL and still got the same results:</p> <pre><code>curl -v -k --header "Content-Type: application/x-www-form-urlencoded" \ -F 'code=4/U2su0fwiynq4v8J8xD56ohfF0fX6.EhP0brx3cosbuJJVnL49Cc8EFE7ncQI' \ -F 'client_id=012345678901-abcdefghijklmnopqrstuvwxyz012345.apps.googleusercontent.com' \ -F 'client_secret=ABC123ABC123ABC123ABC123' \ -F 'grant_type=authorization_code' \ -F 'redirect_uri=https://app.myserver.com/googleLogin.php' \ https://accounts.google.com/o/oauth2/token </code></pre> <p>The response I receive is:</p> <pre><code>&gt; https://accounts.google.com/o/oauth2/token * About to connect() to accounts.google.com port 443 (#0) * Trying 173.194.77.84... connected * Connected to accounts.google.com (173.194.77.84) port 443 (#0) * SSLv3, TLS handshake, Client hello (1): * SSLv3, TLS handshake, Server hello (2): * SSLv3, TLS handshake, CERT (11): * SSLv3, TLS handshake, Server finished (14): * SSLv3, TLS handshake, Client key exchange (16): * SSLv3, TLS change cipher, Client hello (1): * SSLv3, TLS handshake, Finished (20): * SSLv3, TLS change cipher, Client hello (1): * SSLv3, TLS handshake, Finished (20): * SSL connection using RC4-SHA * Server certificate: * subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=accounts.google.com * start date: 2011-07-21 00:00:00 GMT * expire date: 2013-07-18 23:59:59 GMT * common name: accounts.google.com (matched) * issuer: C=ZA; O=Thawte Consulting (Pty) Ltd.; CN=Thawte SGC CA * SSL certificate verify ok. &gt; POST /o/oauth2/token HTTP/1.1 &gt; User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5 &gt; Host: accounts.google.com &gt; Accept: */* &gt; Content-Length: 771 &gt; Expect: 100-continue &gt; Content-Type: application/x-www-form-urlencoded; boundary=----------------------------0d3dc3507a7f &gt; * Done waiting for 100-continue &lt; HTTP/1.1 400 Bad Request &lt; Cache-Control: no-cache, no-store, max-age=0, must-revalidate &lt; Pragma: no-cache &lt; Expires: Fri, 01 Jan 1990 00:00:00 GMT &lt; Date: Sat, 04 Aug 2012 22:07:07 GMT &lt; Content-Type: application/json &lt; X-Content-Type-Options: nosniff &lt; X-Frame-Options: SAMEORIGIN &lt; X-XSS-Protection: 1; mode=block &lt; Server: GSE &lt; Transfer-Encoding: chunked &lt; { "error" : "invalid_request" * Connection #0 to host accounts.google.com left intact * Closing connection #0 * SSLv3, TLS alert, Client hello (1): </code></pre> <p>I'm not url-encoding anything before I send it, but when I do, I get the same result.</p> <p>Any help is greatly appreciated!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload