A project from https://console.developers.google.com/ has:

  • client-id
  • secret

Scopes: e.g. google drive api scopes

We need to get refresh token & access token:

# Authorization link.  Place this in a browser and copy the code that is returned after you accept the scopes.
https://accounts.google.com/o/oauth2/auth?client_id=[Client Id]&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=[Scopes]&response_type=code

# Exchange Authorization code for an access token and a refresh token.
curl -X POST \
     -d 'code=[Authentcation code]&client_id=[Client Id]&client_secret=[Secret]&redirect_uri=urn:ietf:wg:oauth:2.0:oob&grant_type=authorization_code' \
     https://accounts.google.com/o/oauth2/token

# Exchange a refresh token for a new access token.
curl -X POST \
     -d 'client_id=[Client Id]&client_secret=[Secret]&refresh_token=[Refresh token]&grant_type=refresh_token' \
     https://accounts.google.com/o/oauth2/token

clj code:

(-> "https://www.googleapis.com/oauth2/v4/token"
    (http/post {:form-params {:refresh_token refresh-token
                              :client_id     client-id
                              :client_secret client-secret
                              :grant_type    "refresh_token"}
                :as          :json})
    (get-in [:body :access_token]))