title: How to get Google OAuth 2.0 Access token directly using curl? (without using Google Libraries)
body: <p>I'm trying to follow <a href="https://developers.google.com/identity/protocols/OAuth2#webserver" rel="noreferrer">this</a> tutorial to authenticate with Google using their OAuth 2.0 API. However, I would like to make straight <code>curl</code> calls rather than use their libraries.</p>
  
  <p>I have obtained my Client ID and Client Secret Key. 
  Now I'm trying to get the access token like this:</p>
  
  <pre><code>curl \
  --request POST \
  --header "Content-Type: application/json" \
  --data '{
    "client_id":"MY_CLIENT_ID",
    "client_secret":"MY_SECRET_KEY",
    "redirect_uri": "http://localhost/etc",
    "grant_type":"authorization_code"
  }' \
  "https://accounts.google.com/o/oauth2/token"
  </code></pre>
  
  <p>However, it is not working. It gives me the following error:</p>
  
  <pre><code>{
    "error" : "invalid_request",
    "error_description" : "Required parameter is missing: grant_type"
  }
  </code></pre>
  
  <p>Can someone please provide me sample curl call to obtain the access token (and refresh token)?</p>