Diving in google apis authentication

Diving in Google Drive APIs – Authentication

Last updated on May 13th, 2026 by Adnan





In Part 2 of the Google Drive Series, we are going to dig into the most important and confusing concept of connecting with Google APIs. Yes, I wrote ‘confusing’ because many developers get confused when they need to implement connectivity for their applications 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 a project in Google Developers Console, and before that, have downloaded the PHP Client libraries to play with.

Types of Authentication

To access Google data, such as Google Drive, Analytics, or YouTube, you need to be authorized or authenticated with a Google account. It is like “Login with Google” to access the data in 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 is also known as OAuth 2.0 Client ID. It is useful if you have built a web application and want individual users to access their data on behalf of your credentials, which you created in Google Developer Console, i.e., you have your own Client ID and Secret keys.

Your web app actually takes permission from users to access their data. It asks for a login from users. There are different permissions scopes e.g your web app can access only metadata 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 to your Google Drive folder, and then you display that folder for the public on a page. This way, you will be using Google Drive’s storage instead of your hosting server space. All the photos will be displayed on 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 what the ways are that you can use in your apps. If you are still unsure that what method is suitable for you. Don’t hesitate to ask in the comments below or the 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.

Share on




Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.