Instructions
Add-on Details
The Google OAuth add-on will enable your users to login with Google. Refer to the Google OAuth documentation on how to obtain client credentials, which will be required to use this add-on.
Note: The PHP cURL extension is required for this add-on to work.
How To Add
Add the "google-oauth.php" file to your project directory.
Edit the "config.php" file and add the following constants:
/* Google OAuth */
// The OAuth client ID associated with your API console account.
define('google_oauth_client_id','YOUR_CLIENT_ID');
// The OAuth client secret associated with your API console account.
define('google_oauth_client_secret','YOUR_SECRET_KEY');
// The URL to the Google OAuth file.
define('google_oauth_redirect_uri','http://localhost/phplogin/google-oauth.php');
Edit the "index.php" file and find this line:
<button class="btn blue" type="submit">Login</button>
Add below:
<a href="google-oauth.php" class="gl-btn">
<svg width="14" height="14" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 488 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z"/></svg>
Login with Google
</a>
That's all you need to do. Make sure to update the new constants in the config file. If it doesn't work, make sure you have the PHP cURL extension enabled.