title: Invalid_grant error on trying to get access token googleapi
body: <p>I'm following the steps <a href="https://developers.google.com/identity/protocols/OAuth2InstalledApp" rel="nofollow noreferrer">here</a> .  I've got the <code>authorization code</code> in the browser, but get a:</p>
  
  <blockquote>
    <p>** Access error: protocol error: "Server error: HTTP/1.0 400 Bad Request" </p>
  </blockquote>
  
  <p>when I generate my request to try and obtain my token.  I changed the target to http so that I could trace the http request in wireshark and I get this with line wrap added:</p>
  
  <pre><code>POST /oauth2/v3/token HTTP/1.0
  Accept: */*
  Accept-Charset: utf-8
  Host: www.googleapis.com
  User-Agent: REBOL
  Content-Type: application/x-www-form-urlencoded
  Content-Length: 251
  
  code=url-encoded-my-authorisation-code&amp;
  client_id=my-client-id.apps.googleusercontent.com&amp;
  client_secret=my-client-secret&amp;
  redirect_uri=urn-blah-blah&amp;
  grant_type=authorization_code
  </code></pre>
  
  <p>which looks good to me. </p>
  
  <p>When I use the http instead, I get this message </p>
  
  <pre><code>{"error":"internal_failure","error_description":"SSL is required to perform this operation."}
  </code></pre>
  
  <p>but unfortunately it's not telling me if my request is otherwise off to help me with the ssl request.</p>
  
  <p>PS: I've progressed further. I removed the URL encoding from the redirect_uri and now I get an invalid_grant error. Before this it complained of a missing scheme for the redirect_uri.</p>
  
  <p>On one occasion I did success in obtaining an access token but I've not been able to reproduce this. I saw my app listed in those I've granted access tokens. I removed my app and tried to grant again but keep failing.</p>
  
  <p>My clock is correct so that's not the issue. The oauth2 playground works fine and as far as i can tell I'm doing the same but without success.</p>
  
  <p>Mine is an installed app so I can't provide my credentials to the playground as a way to  trust their redirect_uri is not provided and I get an error.</p>