# Client id from Google Developer console | |
# Client Secret from Google Developer console | |
# Scope this is a space seprated list of the scopes of access you are requesting. | |
# 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=[Application 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 \ | |
--request POST \ | |
--data "code=[Authentcation code from authorization link]&client_id=[Application Client Id]&client_secret=[Application Client 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 \ | |
--request POST \ | |
--data 'client_id=[Application Client Id]&client_secret=[Application Client Secret]&refresh_token=[Refresh token granted by second step]&grant_type=refresh_token' \ | |
https://accounts.google.com/o/oauth2/token |
This comment has been minimized.
This comment has been minimized.
@bmsrox
|
This comment has been minimized.
This comment has been minimized.
Hi All, How to authenticate gmail user for google calendar using curl statements? can you please help me out |
This comment has been minimized.
This comment has been minimized.
Note it also works using
now links to How to connect to the Google Drive API using cURL? |
This comment has been minimized.
This comment has been minimized.
Similar but with all the steps and macro replacements |
This comment has been minimized.
This comment has been minimized.
Hi All, Then I changed the grant_type=client_credentials and tried. But again get the error that pasted below. curl Respose: Also, tried LindaLawton's curl command that pasted below and getting the error. curl -d client_id=954040553015-bphgid2596t65i91827omteq778cp7gj.apps.googleusercontent.com -d client_secret=Sn3giYFFPMCNteKC--938xsP -d grant_type=authorization_code -d redirect_uri=urn:ietf:wg:oauth:2.0:oob -d code=4/GQEg70zaxHAuRhhd6A1RB_6LIxwwBV8ak5xRP-nZIBTjuvt4g3fTWyU https://accounts.google.com/o/oauth2/token Response: |
This comment has been minimized.
This comment has been minimized.
Got invalid_grant as well. The reason is that the given authorization code can only be used once. If one performs a malformed request with the code, it is now lost and you should retrive a new one. I am performing those steps using httpie, so it looks like:
|
This comment has been minimized.
This comment has been minimized.
TRYED IT WORKed |
This comment has been minimized.
Hi ... I've been trying to use that, but show an error
{ "error" : "invalid_request", "error_description" : "Required parameter is missing: grant_type" }