You need to get a client ID and client secret from Google to work with the Export Salesforce Leads to Google Spreadsheet scenario. Let's see how to do that.
- Open the Google API Console Credentials page .
Click Create to create a new project (e.g., My Project). If you already have a project, select it from the Select a project drop-down list.
Click the Auth content screen tab, give a product name (e.g., Integration scenario), and click Save .
On the Credentials page that opens, click Create credentials , and then select OAuth client ID .
Under Application type , select Web application and then give the following information. Click Create once done .
Give an appropriate name (e.g., Google).
Under Authorized redirect URIs, enter https://developers.google.com/oauthplayground .
Note down the client ID and client secret that are created . You need them later in this guide.
Next, let's enable the Gmail and Google Sheet APIs.
Click the Library link in the left-hand panel, type gmail, and click the Gmail API link to open it.
Enable the API by clicking the ENABLE link, if it isn't enabled already.
Similarly, enable the Google Sheets API.
- Go to OAuth2 Playground, which should pre-populate some key values for you.
- Click the gear icon
in the upper, right-hand corner and do the following:
- Check the box labeled Use your own OAuth credentials.
- Set OAuth flow to Server-side.
- Set Access type to Offline. (This ensures that you get a refresh token as well as an access token, instead of just an access token).
- Enter the OAuth2 client ID and OAuth2 client secret you obtained earlier.
- In the Step 1 - Select & authorize APIs section on the left-hand side of the screen, expand Gmail API v1 and select all the URLs underneath it except the gmail.metadata.
- Similarly, expand Google Sheets API V4, select all the URLs underneath it, and then click Authorize APIs:
- If prompted, log in to the account to which you want to grant access and authorization. If not, confirm that the current Google user in the top right corner is the AdWords or manager account to whom you want to obtain the credentials.
- In the Step 2 - Exchange authorization code for tokens section, note that you now see an authorization code. Click Exchange authorization code for tokens.
- Note that you see the Refresh token and Access token filled in for you in Step 2 - Exchange authorization code for tokens. If not, expand this section again to refresh it.