How to generate OAuth2 access token and refresh token (example: Google Drive)

Version 2

    Author: Chihab Messaoud, Informatica


    This document aims to explain how one can generate OAuth2 refresh token. With OAuth2 authentication getting prominence, you would be better equipped to deal with this when you want to leverage the same in Cloud Application Integration or Cloud Data Integration connections.


    We will take the example of a popular Google Application "Google Drive" to exemplify how this be done.


    Follow below steps to connect to Google Drive using API:

    • Enable Google Drive API on your Google account
    • Obtain the access token by completing the following steps using Google Chrome:


      • Go to the Library page and in the right panel, click Google Drive API and then click ENABLE to enable the Google Drive API that allows Informatica Cloud Secure Agent to access resources from Google Drive.


      • Go to the Credentials page and click Create credentials/OAuth Cliend ID:


      • Click Create credentials > OAuth client ID, and in the Create client ID page, create a new client ID such as “INFA Secure Agent 1”, with Application type set to Web application and Authorized redirect URIs set to


      • Click the “Create” button at bottom left corner, this will generate a client id and secret for you.


    • Copy the generated client id and secret somewhere for later use.
    • Go to the Google Developers OAuth 2.0 Playground, click the OAuth 2.0 Configuration icon at top right, check “Use your own OAuth credentials”, and enter the client id and secret that has been generated in previous step. Click the Close link at bottom left of the OAuth 2.0 Configuration window:


    • In OAuth 2.0 Playground Step 1, scroll down the list box and select the scope Drive API v3 > for the Google Drive API and click Authorize APIs, then click Allow to generate the authorization code.


    • Once you authorize using your used Google account, you get an access and refresh tokens returned as shown below:


    • Copy the refresh token just after the client id and secret that you saved before. These will be needed for creating a connection in Informatica Cloud Data Integration / Informatica Cloud Application Integration.
    • The connection can then be used for building DI tasks using Google Drive either as a source or target OR in Application Integration Processes.