Appendix 15: Google Refresh Token Generation

Appendix 15: Google Refresh Token Generation



Appendix 15: Google Refresh Token Generation

It is assumed that you have a Google developer console account created on https://console.developers.google.com. 

In this Appendix we complete the Google Spreadsheet steps prerequisites.

  1. Enable APIs for Google Drive and Google Spreadsheet 
  2. Generate Client ID and Client Secret 
  3. Generate Refresh Token in exchange for the Client ID and Client Secret

References

Google Spreadsheet documentation

https://developers.google.com/sheets/api


Enable APIs

In this section we will Enable APIs for Google Drive and Google Spreadsheet. 

  1. Go to the Google Developer Console (https://console.developers.google.com/) 


  1. Click Select a Project or create a New Project. If you have an existing project, you can select it from ALL. 


  1. Provide valid values for the project and click on the Create button. 


  1. Navigate to Dashboard on Google Developer console and Click on ENABLE APIS AND SERVICES. 


  1. Search for Google Drive API and Google Sheets API. Click on Enable. 


  1. The following screenshot shows Google Sheets API. Click on Enable. 




Get a Client ID and Client Secret 


  1. Navigate to the tab OAuth consent screen and choose the valid option.




  1. Enter the Application name, Authorized domains, and click on the Save button.   



  1. Click on Credentials menu >> Create Credentials and from the dropdown list select OAuth client ID. 



  1. From the Application type, select the Web Application. 


  1. Enter valid Name and Authorized Redirect URIs. Click on the Create button. 



  1. Copy Client ID and Client Secret. Click on the OK button. 


  1. Get Client ID and Client Secret by clicking on the OAuth 2.0 Client IDs


Generate Refresh Token 

In this section we will generate Refresh Tokens using Client ID and Client Secret on Google OAuth 2.0 Playground.

  1. Go to the Google OAuth Playground (https://developers.google.com/oauthplayground/)
  2. Click on the Settings icon.
  3. Click on Use your own OAuth credentials and enter OAuth Client ID and OAuth Client secret generated from the previous step. 
  4. Copy the following URL ‘https://developers.google.com/oauthplayground



  |



  1. Open the Credentials tab on Google Developer Console, select created Client ID by clicking on the Name. 







  1. Paste the above copied URL in Authorised redirect URIs and click on Save button.



  1. Navigate back to Google OAuth Playground and click on Select & authorize APIs.
  2. Select the Select & authorize APIs. Select the desired scope you want for your application and click on Authorize APIs. 




  1. Select the following scope under tab Drive API v3 - https://www.googleapis.com/auth/drive’





  1. Click on Exchange authorization code for tokens.
  2.  


  1. You’ll get the Authorization code, Click on the Exchange authorization code for tokens button.
  2. Copy Refresh Token.

This completes the process of Enabling APIs, getting Client ID and Client Secret and Generation of Refresh Token required for connecting to google Spreadsheet.





      Links to better reach 

            Bot Store

             EPD