Download the PHP package keukenmagazijn/laravel-google-authentication without Composer

On this page you can find all versions of the php package keukenmagazijn/laravel-google-authentication. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-google-authentication

Introduction

This package allows users to quickly authenticate using their Google account with Google Identity. You are able to specify a domain the user' account must be in - or you can just allow anyone to register.

The package extends and works together with the default Laravel authentication, but it requires modification and additions to the default tables provided by Laravel.

Installation

Your users table will be reformed and you will have to have the following migration available in your application:

Migrations

If you have already ran the default php artisan make:auth command you will need to change your columns to uphold the same columns and their types mentioned above.

The package provides the rest of the required migrations, such as user_roles, roles and a google_oauth_tokens_table.

You have the option to create either tables or to create views if your database architecture requires you to do so. In the latter case you need to configure the configured alias name and the database name itself that you want to source the data from in the config/google_identity.php file and you will need to change the migrations.create_views_instead_of_tables value from false to true.

Or add the following config keys to your .env file and configure it with your config values:

Configuration

Once you have configured the migration you will have to publish the configuration file by running php artisan vendor:publish --tag=km. Be sure to edit the package properly to your environment.

UsesGoogleIdentity trait

Once your package is published you will have to add the Keukenmagazijn\LaravelGoogleAuthentication Trait to your User model, ie.:

Button rendering and Identity

You can render the authorization button by adding the following code to your blade:

When a user authorizes it will check if the user account is within the whitelisted domains (configured in your config/google_identity.php file), or if you allowed any domain to register, it will always succeed when permissions are given.

Users authorizing using Google will automatically gain the 'employee' role.

Required entities

The following models/entities should be available in your application.

User.php (this is my example)
GoogleOauthToken.php
Role.php

Google Identity

You need to set-up a route for your Google Identity to call back to, this is done in Google Identity itself. Once you have those configuration settings, you should now fill add the following data to your .env file and fill it with the corresponding data:

Routing

The next step is to set-up a get route for the GOOGLE_IDENTITY_REDIRECT_URI uri. There is a controller available within the package to handle the callback for you and it will redirect you back to the named route defined as callback_redirect_route_name in the config/google_identity.php file.

If you want to customize the callback method you can set-up a custom controller for it and use the GoogleIdentityController as an example on how to use the GoogleIdentityFacade.

An example route where GOOGLE_IDENTITY_REDIRECT_URI='http://appurl.extension/identity/callback':


All versions of laravel-google-authentication with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
laravel/framework Version ^10.0
google/apiclient Version ^2.2
astrotomic/laravel-translatable Version ^11.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package keukenmagazijn/laravel-google-authentication contains the following files

Loading the files please wait ....