Download the PHP package runthis/laravel-google-auth without Composer
On this page you can find all versions of the php package runthis/laravel-google-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download runthis/laravel-google-auth
More information about runthis/laravel-google-auth
Files in runthis/laravel-google-auth
Package laravel-google-auth
Short Description Set up google authentication in laravel
License MIT
Homepage https://github.com/runthis/laravel-google-auth
Informations about the package laravel-google-auth
Laravel Google Authentication
A tiny laravel package to authenticate users via google with domain verification.
Installation
composer require runthis/laravel-google-auth
Setup
Head over to https://console.cloud.google.com/apis/credentials and set up some oauth credentials. Note the client id.
Laravel
Open up your .env file and add the following keys and adjust as necessary.
GOOGLE_CLIENT_ID="xxx.apps.googleusercontent.com"
GOOGLE_BASE_ROUTE="/login"
GOOGLE_AUTH_ROUTE="/auth/callback"
GOOGLE_VALID_DOMAIN="domain.com"
With the above environment variables; When a user visits /login in your application, they will be presented with a page containing a button to sign in with Google.
Usage
Package emits Runthis\Login\Events\UserWasAuthenticatedWithGoogle
when google login is successful and contains an array payload with various keys provided by google (name, email, picture, etc).
Create a listener in Laravel. Add use Runthis\Login\Events\UserWasAuthenticatedWithGoogle;
. Set the handle method parameter to UserWasAuthenticatedWithGoogle $event
. Handle the event as you want (logging the user in, adding to database if you like, etc).
Changelog
Please see CHANGELOG for more information on what has changed recently.
All versions of laravel-google-auth with dependencies
google/apiclient Version ^2.12.1
guzzlehttp/guzzle Version ^7.4
illuminate/contracts Version ^10.0
illuminate/http Version ^10.0
illuminate/support Version ^10.0
spatie/laravel-package-tools Version ^1.9.2