Download the PHP package coloredcow/laravel-gsuite without Composer
On this page you can find all versions of the php package coloredcow/laravel-gsuite. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download coloredcow/laravel-gsuite
More information about coloredcow/laravel-gsuite
Files in coloredcow/laravel-gsuite
Package laravel-gsuite
Short Description A Laravel package to setup Google OAuth and GSuite Admin SDK
License MIT
Homepage https://github.com/coloredcow/laravel-gsuite
Informations about the package laravel-gsuite
Laravel GSuite
A Laravel package to setup Google OAuth and GSuite Admin SDK.
Installation
You can install the package using composer
Publish the configurations
Setting up Google Oauth
Update your .env file with the Google OAuth 2.0 credentials
NOTE: If you wish to restrict users to your organization's domain, add to your .env
Inside your app/Http/Controllers/Auth/LoginController.php
, use the package trait GSuiteLogin
That's it! Go to your_app_url/auth/google
and use your Google email to login.
Setting up GSuite Admin Service
In your .env
file, add the following credentials:
To know more about service account and steps to get one, visit the official Google Documentation.
NOTE: Make sure you enable Domain-wide Delegation
when creating the service account for your project.
You can now use various services provided by the package. For example, if you want to fetch a user details, you can use the GSuiteUserService
facade.
Enabling multitenancy
There are some additional steps required in case your application supports multitenancy.
Set multitenancy to true in your config/gsuite.php
The default value for tenant connection is tenant
. If you're using a different name for tenant connection, update config/gsuite.php
Since you'll have multiple tenants, and you may need different GSuite API credentials for each of them, the package will create a table in each tenant database. This table will store the required gsuite credentials.
Publish the tenant specific migrations using the following command. This will publish the migrations into database/migrations/tenant
directory.
Now, create your tenant databases.
NOTE: If you already have existing tenants, you may need to recreate those tenant databases. You may lose some data if not done carefully.
In every tenant database, you need to define the application credentials and service account impersonate user. You can add a seeder to your multitenancy implementation so that it runs everytime a new tenant database is created.
Your gsuite_configurations
table should look this
id | key | value | created_at | updated_at |
---|---|---|---|---|
1 | application_credentials | full_path_to_credentials.json | 2018-06-06 16:00:00 | 2018-06-06 16:00:00 |
2 | service_account_impersonate | [email protected] |
2018-06-06 16:00:00 | 2018-06-06 16:00:00 |
More multitenancy configurations
If you prefer to have a different name for the gsuite_configurations
table, update config/gsuite.php
If you prefer to override the package's GSuiteConfiguration
model, create a custom model that must implement the ColoredCow\LaravelGSuite\Contracts\Tenant\GSuiteConfiguration
contract. Then, update your config/gsuite.php
and replace the default model with the new model.
All versions of laravel-gsuite with dependencies
laravel/socialite Version ^3.0
google/auth Version ^1.3
google/apiclient Version ^2.2
doctrine/dbal Version ^2.8