How to Integrate Google Login (GIS Button + One Tap + OAuth 2.0 Redirect Code) in PHP & MySQL (2026)
Aug 30, 2026
Buy the full source code of application here:
https://procodestore.com/index.php/product/how-to-integrate-google-login-gis-button-one-tap-oauth-2-0-redirect-code-in-php-mysql-2026/
Watch My Visual Studio Code IDE Setup Video For Fonts,Themes & Extensions
https://youtu.be/Bon8Pm1gbX8
Hi Join the official discord server to resolve doubts here:
https://discord.gg/cRnjhk6nzW
Visit my Online Free Media Tool Website
https://freemediatools.com/
Buy Premium Scripts and Apps Here:
Show More Show Less View Video Transcript
0:00
Uh, hello guys, in this video I'll show
0:02
you how to build a Google login
0:04
authentication system in PHP and MySQL
0:07
database. And I actually prepared this
0:09
PHP script which supports all the three
0:12
authentication types which are supported
0:13
in 2026 by Google. The very first
0:17
authentication is a pop-up as you see.
0:19
We are running this and it automatically
0:21
detecting that you are logged in as this
0:24
email address. Second one is Google
0:26
Identity Services.
0:28
This also I will integrated this. The
0:30
third one is Google OAuth 2 redirect.
0:34
So, this is the old flow by which you
0:36
are redirected to a page where you need
0:37
to grant access.
0:39
So, let me show you the directory
0:40
structure of the project. This is
0:42
actually the PHP project that I created.
0:46
If you need the source code, full source
0:47
code, I've given the link. You can
0:49
directly purchase it. Go to my website
0:51
procode.store.com.
0:53
And once you purchase it, you will get
0:55
the source code from Google Drive.
0:57
Uh, now I will show you how to configure
0:59
it. So, first of all, you need to have
1:01
this software XAMPP control panel.
1:04
So, if you are a PHP developer, you have
1:06
known this software. This allows you to
1:08
run your projects locally.
1:11
It has Apache server, MySQL database as
1:13
well. So, I'm all already running these
1:15
two things.
1:17
So, the very first thing you need to do,
1:18
you need to import this database. So,
1:20
this is your database SQL file that I
1:22
prepared for this Google authentication
1:25
system.
1:26
So, all the things it will be storing
1:28
once you authenticate. So, just open
1:31
localhost/phpmyadmin
1:34
and click on the import button. So, we
1:36
just need to import this SQL file.
1:39
Um, just choose this file the which is
1:42
database SQL file.
1:45
So, it will already create the database
1:47
and the tables. So, click on import.
1:50
So, now as you see
1:52
the database which is Google login DB
1:54
has been successfully created.
1:57
If I show you, it contains these two
1:59
tables. This is the main table users.
2:02
So, it will actually hold all the
2:03
information related to the user, such as
2:06
ID, Google ID, email address, name,
2:09
picture, profile picture, email
2:11
verified, created at last login.
2:13
So, if I try to authenticate now
2:16
by selecting account.
2:18
So, if I
2:20
just use this pop-up authentication. So,
2:23
now as you see, it will redirect me to
2:25
the dashboard page. So, it will show you
2:27
all the information, such as the display
2:29
name, profile picture, email address,
2:32
the profile ID.
2:34
This is a user ID.
2:36
It will display this information, joined
2:39
at, last login,
2:41
if the email is verified or not.
2:44
So, we also have the logout button as
2:46
well, if you do want to log out.
2:48
So, all this information, as you see, is
2:50
returned as a JSON response.
2:52
So,
2:53
the this information, we are displaying
2:55
it on the page. So, if I try to now,
2:58
once again,
2:59
it will redirect me, it will
3:01
automatically detect that you're logged
3:03
in.
3:03
If I close this window, again try to
3:06
open the same window.
3:07
Now, it will detect.
3:10
So, it has a mechanism, it will
3:11
automatically detect that you're already
3:13
logged in. So, it will redirect me to
3:15
the dashboard page.
3:16
So, now if I check the database, if I
3:19
refresh it, now you will see that a
3:22
entry has been successfully generated.
3:25
So, ID, Google ID, this is the email
3:27
address,
3:28
display name, profile picture.
3:32
All the information is stored.
3:34
So, you can try this with any account,
3:36
guys. Let me try this with a different
3:37
account.
3:41
So,
3:42
now as you see, again
3:45
all the three authentication types have
3:47
been supported.
3:48
So, it will automatically detect, as you
3:50
see,
3:51
let me now try this authentication type.
3:54
This also works.
3:56
This is called as Google Identity
3:58
Services. This is a second
3:59
authentication type. Again, you select
4:02
the account.
4:03
And as you see that automatically this
4:07
will redirect you.
4:10
If you do want to log out, you will see
4:12
that it will log out.
4:14
Right.
4:16
Show you the database here. Now you will
4:18
see two entries will be there.
4:21
The database will automatically update
4:23
as soon as
4:25
new users are authenticated.
4:28
Now let me also show you the
4:31
third authentication type, which is this
4:33
one.
4:35
OAuth redirect. So this is the old
4:37
authentication type where you it will
4:39
redirect you to the another screen where
4:41
you need to select your account
4:44
like this.
4:46
Need to continue, allow the permission.
4:50
So these are all the three
4:51
authentication types, guys. If you are
4:53
looking forward for a ultimate PHP
4:55
Google login script, you're watching the
4:58
correct video. So I have given the link
5:00
in the description. So
5:02
once you purchase it, you will get this
5:04
entire PHP script.
5:06
So this is your callback config. So now
5:10
to configure this, you need to If you
5:12
purchase it, just go go to this file
5:15
config.php.
5:17
So right here you need to replace all
5:18
the database settings such as
5:21
So by default, if you're using XAMPP, so
5:24
host name, you will just
5:25
replace the database name right here,
5:28
username, password, everything.
5:31
Then we need these two things from
5:33
Google client ID and Google client
5:35
secret. So this you can easily get if
5:38
you go to Google Cloud Console.
5:41
So right here you need to create this
5:44
OAuth client ID.
5:52
So, if you click on that Google OAuth
5:54
client ID, so this is mandatory. You
5:57
need to do this because after you do
5:59
this
6:01
you need to enter your base in the
6:03
authorized JavaScript origins.
6:06
We just need to add this HTTP localhost
6:09
wherever you are developing your
6:10
application. So, we are developing it on
6:12
localhost 80 port number.
6:15
So, just add this.
6:19
Select your application type to be web
6:21
application.
6:23
And in the authorized JavaScript origin,
6:26
simply
6:28
localhost. That's all.
6:30
In the authorized redirect URI
6:34
so, just select your redirect URI
6:37
which is HTTP localhost.
6:42
This URL, which is HTTP localhost
6:44
google_login_callback.php.
6:50
So, just paste this.
6:52
So, after you paste both these things,
6:54
you click on create. As soon as you do
6:57
this, you will get your client ID and
6:59
client secret.
7:01
That's all that you need to do. Just
7:03
paste this client secret client ID
7:05
inside this config.php.
7:08
So, that's all that you need to do the
7:09
configuration settings. After that, your
7:11
application will run.
7:14
So, just go to config.php file and just
7:16
fill out these details.
7:18
And just upload this database.sql file
7:22
inside your
7:24
PHP myAdmin that I showed you earlier
7:26
on.
7:27
So, after that guys, it's a automated
7:29
script. Once you run the application,
7:32
once you perform the authentication,
7:35
automatically all the results will be
7:38
inserted information.
7:40
So, this is the full PHP MySQL script
7:44
that I prepared.
7:46
You will see all the files are there.
7:53
So, if you go to the description link,
7:56
you will be redirected to my website.
7:59
So, once you purchase it, you will get
8:00
this
8:01
uh
8:03
this zip file. You just need to extract
8:06
the zip file from Google Drive
8:08
and you will get the full source code.
8:10
So, thank you very much for watching
8:11
this video.
8:13
Please hit that like button. Subscribe
8:14
the channel as well.
#Jobs & Education
