×

IndoCodr Docs

Active eCommerce Google One Tap Login Add-on Documentation

How to install the addon?


Answer: To install the Google One Tap you need to follow the below steps :

Step 0: Copy Required Files

Before starting, copy the necessary files:

  • Controllers: Copy GoogleOneTapController.php from controllers folder to /app/Http/Controllers/
  • Views: Copy google_onetap.blade.php from views/frontend/partials to /resources/views/partials/

1. Add Logout Flash Message

File: /home/USERNAME/public_html/app/Http/Controllers/Auth/LoginController.php

Steps:

  • Open the file.
  • Go to the method: public function logout
  • Add the following line AFTER $this->guard()->logout();:
session()->flash('logout', true);

Explanation:

  • This stores a temporary session variable 'logout' when a user logs out.
  • Useful for showing logout success messages on the frontend.

2. Add Google One Tap Route

File: /home/USERNAME/public_html/routes/web.php

Steps:

  • At the top, add:
use App\Http\Controllers\GoogleOneTapController;
  • At the bottom (or anywhere), add:
// Google One Tap
Route::post('/google-one-tap/callback', [GoogleOneTapController::class, 'callback'])->name('google.one.tap.callback');

Explanation:

  • This route handles the callback from Google One Tap login.

3. Include Google One Tap Script in Frontend

File: /home/USERNAME/public_html/resources/views/frontend/layouts/app.blade.php

Steps:

  • Find the <body> tag.
  • Immediately after it, add:
@if (addon_is_activated('google_one_tap'))
    @include('frontend.partials.google_onetap')
@endif

Explanation:

  • This will load the Google One Tap script if the addon is activated.

4. Configure Google Console

Steps:

  1. Go to Google Cloud Console: https://console.cloud.google.com/
  2. Select your project (the one used for Google login).
  3. Under Credentials:
    • Authorized JavaScript origins:
      • Add your domain: https://example.com
    • Authorized redirect URIs:
      • Existing: https://example.com/social-login/google/callback
      • Add another for One Tap: https://example.com/google-one-tap/callback

Explanation:

  • JavaScript origins are required to allow Google scripts to run on your domain.
  • Redirect URIs tell Google where to send login responses.

5. Test Google One Tap

  • Open your website.
  • You should see the One Tap login popup.
  • Test login functionality.

×