Skip to content

Latest commit

 

History

History
59 lines (50 loc) · 1.61 KB

README.md

File metadata and controls

59 lines (50 loc) · 1.61 KB

Latest Version on Packagist Total Downloads

google-one-tap

Login with google one tap/google popup login for Laravel title


Installation

requires

  • php: >=8.1
  • laravel/framework: ^9.0 || ^10.0 || ^11.0
composer require phhung1901/google_one_tap

Config

Add configuration to config/services.php

'google' => [
  'client_id' => env('GOOGLE_CLIENT_ID'),
  'client_secret' => env('GOOGLE_CLIENT_SECRET'),
  'redirect' => env('GOOGLE_URL')
],

Usage

1. Added to scripts

<script src="https://accounts.google.com/gsi/client" async="" defer=""></script>

2. Next, you must publish the component

Add to providers config/app.php

\GoogleOneTap\Services\GoogleOneTapServiceProvider::class,
php artisan vendor:publish --tag=google_one_tap

Now, add the component wherever you want google_one_tap to be used.

<x-google_one_tap.onload/>

Config googe-one-tap.php you can add customizations

3. Returned User fields

$token = GoogleOneTapService::getToken($request);
return Socialite::driver('google-one-tap')->stateless()->userFromToken($token)

License

The MIT License (MIT). Please see License File for more information.