Google Drive API Setup for Laravel 11 Integration (Part 1)

Arlind Musliu Portrait
Arlind Musliu

January 24, 2024 · 4 min read · 2,459 views

Laravel and Google Drive Blogpost Image


Our previously published guide: Google Drive integration with Laravel has become the most viewed post on our blog, highlighting the significant interest and demand for cloud storage solutions within the Laravel community. Recognizing the importance of this topic and the need for current information, we've written this new and updated version of the guide, tailored specifically for Laravel 10.

Setup Google Drive API for Laravel 10

Integrating cloud storage solutions like Google Drive with web applications is becoming increasingly common. Laravel, a robust PHP framework, makes it possible to integrate with various services, including Google Drive, to enhance the functionality of your applications. In this guide, we'll walk you through the process of integrating Google Drive storage with Laravel 10, step by step. By the end of this tutorial, you'll have obtained your Google API credentials and learned how to use them with Laravel Storage, unlocking a range of benefits for your application.

Getting Your Client ID and Secret

To kickstart the process, you need to sign in to your Google Account and access the Google Developers Console at

Creating a New Project

Once in the Google Developers Console, you'll use the dropdown menu at the top of the page to create a new project. This is a straightforward process, but remember that it may take a few seconds for your new project to be ready.

google drive api select a project

Enabling the Google Drive API

With your project selected, head to the Library section to find and enable the Google Drive API. This is a crucial step as it allows your Laravel application to interact with Google Drive.

google drive api manage

Creating Credentials

Navigate to the OAuth Consent Screen tab and provide the necessary details. This includes your application's name, a user support email, and developer contact information. You can leave the other fields as default for the moment.

google drive api edit app registration screen

Scopes and Adding Test Users

The scopes can be left as default, feel free to skip that step. To ensure proper testing, add the email addresses of users authorized for testing.

google drive api edit app registration

Creating OAuth Client ID

Back in the Credentials section, select Create Credentials and choose OAuth Client ID from the dropdown menu.

google drive api create client id

Setting Up Your Web Application for OAuth

Choose Web Application as the application type and provide a meaningful name. You'll also need to add the authorized redirect URI, which for now will be This is necessary for obtaining your refresh token; you can remove it later. Click Create and make sure to record your Client ID and Client Secret, as these are critical for later steps.

google drive api create oauth client

Getting Your Refresh Token

Visit to configure your own OAuth credentials. Enter your Client ID and Client Secret.

google drive api oauth config

Selecting Drive API Scope

Scroll down on the left menu until you find "Drive API v3" and select the option "/auth/drive/. Click on Authorize APIs and permit access to your account when asked. You might see several warning messages, but it's okay to continue through them.

google drive api select button

Auto-refresh your token

After authorizing the APIs, select the option to auto-refresh the token before it expires. Finally, exchange the authorization code for tokens.

google drive api refresh token button

Accessing Your Refresh Token in Step 3

In the last step, you'll be able to retrieve your refresh token, which is necessary for your Laravel application to communicate with Google Drive. We will need this token when we configure our Laravel application.

google drive api refresh token

Configuring Laravel for Google Drive Integration

Having successfully prepared your Google Drive API for use with your Laravel project, the next step is to configure your Laravel application to communicate with Google Drive. In the following article, we will guide you through the necessary steps to establish this connection.

Bring Your Ideas to Life 🚀

If you need help with a Laravel project let's get in touch.

Lucky Media is proud to be recognized as a leading Laravel Development Agency

Arlind Musliu Portrait
Arlind Musliu

Cofounder and CFO of Lucky Media


Heading Pattern

Related Posts

Stay up to date

Be updated with all news, products and tips we share!