Getting Google access code via postman

 

First start by creating a client in Google console API and Services. On your left, click on Credentials-> Create Credential -> OAuth client id -> Create a windows desktop client. 



Then enter details for your client Id and choose Desktop for "client type".



Please note down the client id, which you will be using here: 

 Then replace client_id here with the actual client-id generated. Copy and paste this in your browser. 


https://accounts.google.com/o/oauth2/v2/auth?client_id=
&response_type=code&scope=openid&redirect_uri=urn:ietf:wg:oauth:2.0:oob

Copy and paste this url on your browser and then get the authorization code  - as shown below: 



Then you need to use the following curl command:


curl --location 'https://oauth2.googleapis.com/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=<your-client-id>' \
--data-urlencode 'code=<authorization-code-from-previous-steps>' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'client_secret=<your-client-secret>' \
--data-urlencode 'redirect_uri=urn:ietf:wg:oauth:2.0:oob'















Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm