Diving in Google Drive APIs – Authentication

In this part 2 of Google Drive Series,  We are going to dig the most important and confusing concept of connecting with Google APIs. Yes, I wrote confusing because there many developers who get confused when they need to implement connectivity of their application to Google APIs. I will try to make this concept easier in this post.

I assume you have read the first part of this series and have created project in Google Developers Console and before than that have downloaded the PHP Client libraries to play with.

Types of Authentication

 

To get access of Google data whether It is Google Drive, Analytics or Youtube, you need to be authorized/authenticate by using a Google account. It is like “Login with Google” to get access the data within your application. There are 2 types of Authentication, OAuth 2.0 for web server applications and OAuth 2.0 for server to server applications.

1. OAuth 2.0 for Web Server Applications

 

This method also known as OAuth 2.0 Client ID is useful if you built a web application and want individual users to access their data on the behalf of your credentials which you created in Google Developer Console i.e you have your own Client ID’s and Secret keys.

Your web app actually takes permission from users to access their data. It asks for login from users. There are different permissions scopes e.g your web app can access only meta data of files, email addresses or basic profile information.

There can be multiple uses for this method. Share below if you found any other usage. It will help the readers a lot.

2. OAuth 2.0 for Server to Server Applications

 

In this method known as Service Accounts, you don’t ask users to give you permission to access their data. You actually use your own Google Drive account and credentials and process user actions in your files/folders. For example,You can create a public photos website where you ask users to upload their photos in your Google Drive folder and then you display that folder for public on a page. This way, you will be using Google drives storage instead of your hosting server space. All the photos will be displaying at your web page from your Google Drive account.

There can be multiple uses for this method. Share below if you found any other usage. It will help the readers a lot.

Conclusion

 

So you understand now that what are the ways you can use in your apps. If you are still unsure that what method is suitable for you. Don’t hesitate to ask in comments below or stackoverflow Google Drive SDK group.

Next, we are going to code scripts that will show you how to process the data to and from Google APIs.

Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *