{"id":18916797,"url":"https://github.com/dusterio/laravel-google-guard","last_synced_at":"2025-04-15T09:31:18.221Z","repository":{"id":56973373,"uuid":"87509087","full_name":"dusterio/laravel-google-guard","owner":"dusterio","description":"Auth guard for Laravel that completely relies on Google Login and doesn't persist","archived":false,"fork":false,"pushed_at":"2018-09-21T07:03:43.000Z","size":12,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-17T11:27:59.661Z","etag":null,"topics":["authentication","google","guard","laravel"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dusterio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-07T05:44:41.000Z","updated_at":"2024-04-17T11:27:59.662Z","dependencies_parsed_at":"2022-08-21T10:20:56.171Z","dependency_job_id":null,"html_url":"https://github.com/dusterio/laravel-google-guard","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dusterio%2Flaravel-google-guard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dusterio%2Flaravel-google-guard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dusterio%2Flaravel-google-guard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dusterio%2Flaravel-google-guard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dusterio","download_url":"https://codeload.github.com/dusterio/laravel-google-guard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223665593,"owners_count":17182347,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","google","guard","laravel"],"created_at":"2024-11-08T10:22:02.776Z","updated_at":"2024-11-08T10:22:03.430Z","avatar_url":"https://github.com/dusterio.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# laravel-google-guard\n[![Latest Stable Version](https://poser.pugx.org/dusterio/laravel-google-guard/v/stable)](https://packagist.org/packages/dusterio/laravel-google-guard)\n[![Total Downloads](https://poser.pugx.org/dusterio/laravel-google-guard/downloads)](https://packagist.org/packages/dusterio/laravel-google-guard)\n[![License](https://poser.pugx.org/dusterio/laravel-google-guard/license)](https://packagist.org/packages/dusterio/laravel-google-guard)\n\nAuth guard for Laravel that completely relies on Google Login and doesn't persist\n\n## Overview\n\nSometimes your small application doesn't need local persisted user repository at all. At times like that,\nit's nice to rely on external account repository, eg. Google – nowadays practically everybody got a Google account?\n\nThis authentication guard relies on Google token. Every time your app needs to authenticate a user, it will redirect user\nto Google, then back. If the token is valid, your user will be considered authenticated within your app.\n\nNo persistence at all, just some session caching.\n\nAnd you can of course specify allowed Google users or domains if your application is private. \n\n## Dependencies\n\n- Laravel Socialite\n- Laravel 5.3.*\n\n## Installation\n\nFirst install the package using Packagist:\n```\n$ composer require dusterio/laravel-google-guard\n```\n\nAdd the package service provider to your `config/app.php` to `providers` array:\n```php\nDusterio\\LaravelGoogleGuard\\Integrations\\LaravelServiceProvider::class,\n```\n\nYou should see two extra routes after this:\n```bash\n$ php artisan route:list\n| GET|HEAD | auth/google            |                   | Dusterio\\LaravelGoogleGuard\\Http\\LoginController@redirectToProvider     | guest,web    |\n| GET|HEAD | auth/google/callback   |                   | Dusterio\\LaravelGoogleGuard\\Http\\LoginController@handleProviderCallback | guest,web    |\n```\n\nConfigure the guard in ```config/auth.php```:\n```php\n    'guards' =\u003e [\n        /// Your existing guards\n        /// ...    \n        'google' =\u003e [\n            /*\n             * For consistency, return a dummy (not persisted) class holder.\n            */\n            'userClass' =\u003e '\\App\\User',\n\n            /*\n             * Remember users for this number of seconds.\n             */\n            'timeout' =\u003e 3600,\n\n            /*\n             * Users that can use the app. If left empty, everybody is allowed.\n             */\n            'whitelist' =\u003e [\n                'admin@.',\n            ]\n        ]              \n    ]\n```\n\nMake it a default guard in the same file ```config/auth.php```:\n```php\n        'web' =\u003e [\n            'driver' =\u003e 'google',\n            'provider' =\u003e 'users',\n        ],\n```\n\nAdd your google key and secret to ```config/services.php```, eg.:\n```php\n    'google' =\u003e [\n        'client_id' =\u003e env('GOOGLE_CLIENT_ID'),\n        'client_secret' =\u003e env('GOOGLE_CLIENT_SECRET'),\n        'redirect' =\u003e env('APP_URL') . '/auth/google/callback',\n    ],\n```\n\nThat's it – you are ready to go!\n\n## License\n\nMIT License\n\nCopyright (c) 2017 Denis Mysenko\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdusterio%2Flaravel-google-guard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdusterio%2Flaravel-google-guard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdusterio%2Flaravel-google-guard/lists"}