How to integrate google drive with salesforce org?????

 Google Drive Api Integration 

 

Overview: - 

This document contains all the steps which we have to follow to integrate google drive with salesforce.  

Step: - 1 

Go to Google Cloud Platform and log in with your google account 

  • On left hand side click on select project then click new project 

  • Give your project name and click on create 

  • Now click on Enable Api and services  

  • search for Google Drive API and enable it. 

  • Click on credentials and then create credentials. 

  • Select oAuth Client Id, click on configure consent screen, select user type (External) 

  • Give your app name, support email (It must be your email which you used for login) 

  • In Authorised domains give ‘Salesforce.com’. 

  • Fill Developer contact information give your email 

  • Click on Save and Continue 

  • Click on Add or Remove scopes (Add scopes according to your requirement or you can add all) click on update 

  • Click on Save and Continue 

  • In Add Users add your email 

  • Click on Save and Continue 

  • Click Back to dashboard 

  • Again, click on create credentials then oAuth client Id 

  • Select application type Web application click on create 

  • You will get “client Id & client Secret 

  • Click on download Json for further use 

 
 Step: - 2 

We have done with the google part now move to salesforce org 

  • Login to your org 

  • Go to setup search for Auth Provider in quick find box 

  • Click new 

  • Select provider type to Open ID connect  

  • Give name and paste here Consumer Key (client_id) and Consumer Secret (client_secret)(which you will get from Json we downloaded before from google app)  

  • Also paste Authorize Endpoint URL (auth_uri) and Token Endpoint URL (token_uri) you will get in Json file 

  • Click on save 

  • Copy Callback URL from Auth. Providers 

  • Go back to your google app which you created 

  • Copy the link and paste it in Authorised redirect URIs your credentials (Credentials > OAuth 2.0 client IDs). 

  • Go to salesforce setup search for Named Credentials in quick find box 

  • Click new  

  • Give name in URL paste (https://www.googleapis.com) this 

  • Select Identity Type to Named Principle 

  • In Authentication Protocol Select oAuth 2.0  

  • Select Authentication Provider (auth provider you have created) 

  • In scope paste(https://www.googleapis.com/auth/drive) this. 

  • Click on save it will redirect you to select your Gmail account 

  • Then click allow /Continue 

  • Finally, the Authentication Status on named credentials will changed from pending to Authenticated  

  • Now concatenate (?access_type=offline&approval_prompt=force) to your Authorize Endpoint URL on auth providers to get refresh token also. 

  • Now create Remote Site Settings  

  • Click new and paste (https://www.googlepis.com) in URL. 

 

We have integrated google drive Api successfully. Now you can access and write apex code to get, post data. 

 
 

 

Comments

Popular posts from this blog

Introduction

What is Programming Language??