{"id":21890903,"url":"https://github.com/statikbe/laravel-google-authenticate","last_synced_at":"2025-08-22T07:07:50.941Z","repository":{"id":57059224,"uuid":"161042943","full_name":"statikbe/laravel-google-authenticate","owner":"statikbe","description":"Google Authentication in Laravel","archived":false,"fork":false,"pushed_at":"2025-05-08T15:39:20.000Z","size":100,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-07-14T15:33:47.236Z","etag":null,"topics":[],"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/statikbe.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":"contributing.md","funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-12-09T13:35:51.000Z","updated_at":"2025-05-08T15:39:24.000Z","dependencies_parsed_at":"2025-02-19T12:21:37.028Z","dependency_job_id":"815051df-ab8a-417c-9029-2f2d2f54c34d","html_url":"https://github.com/statikbe/laravel-google-authenticate","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/statikbe/laravel-google-authenticate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statikbe%2Flaravel-google-authenticate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statikbe%2Flaravel-google-authenticate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statikbe%2Flaravel-google-authenticate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statikbe%2Flaravel-google-authenticate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/statikbe","download_url":"https://codeload.github.com/statikbe/laravel-google-authenticate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statikbe%2Flaravel-google-authenticate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271132843,"owners_count":24704708,"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","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-28T12:18:09.429Z","updated_at":"2025-08-22T07:07:50.918Z","avatar_url":"https://github.com/statikbe.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"assets/card.png\" alt=\"Card of Laravel Nova Chained Translation Manager\"\u003e\u003c/p\u003e\n\n# Google Authenticator\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/statikbe/laravel-google-authenticate.svg?style=flat-square)](https://packagist.org/packages/statikbe/laravel-google-authenticate)\n[![Total Downloads](https://img.shields.io/packagist/dt/statikbe/laravel-google-authenticate.svg?style=flat-square)](https://packagist.org/packages/statikbe/laravel-google-authenticate)\n\n\nThis module gives you the option to let you (and your users) log in with their Google account on your Laravel application.\n\nThis is initially used to let only people log in from certain workspaces. But can be enabled to let everyone log in. \n\n\n[Changelog](changelog.md) - [Upgrade guides](upgrade-guide.md)\n\n---\n\n## Installation\n\nUsing Composer\n\n``` bash\ncomposer require statikbe/laravel-google-authenticate\n```\n\n## Usage\n\nThe package will automatically register itself.\n\nYou can publish the migration with the following command:\n``` shell\nphp artisan vendor:publish --provider=\"Statikbe\\GoogleAuthenticate\\GoogleAuthenticateServiceProvider\" --tag=\"google-migrations\"\n```\n\nTo add the needed columns to your database run:\n ``` shell\nphp artisan migrate\n``` \n\nAdd the ```use HasGoogleAuth``` trait in your ```User.php``` class.\nThis will provide the necessary fillable options to your User.\n\nIn your .env file you should include the following keys:\n``` php\nGOOGLE_CLIENT_ID=\"YOUR_GOOGLE_CLIENT_ID\"\nGOOGLE_CLIENT_SECRET=\"YOUR_GOOGLE_CLIENT_SECRET\"\nCALLBACK_URL_GOOGLE=\"https://www.domain.com/login/google/callback\"\n```\n\nThe next step is to add the following lines in your ```services.php``` config file\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('CALLBACK_URL_GOOGLE'),\n    ],\n```\n\nInfo on how to create a Google Auth Client id and secret can be\nfound [on their documentation page](https://developers.google.com/identity/protocols/OAuth2).\n\nFinally, you can add google login route to your login and register views: `{{ route('google.auth.login') }}`.\n\n\n### Config\nPublish the config file\n\n```bash\nphp artisan vendor:publish --provider=\"Statikbe\\\\GoogleAuthenticate\\\\GoogleAuthenticateServiceProvider\" --tag=\"google-config\"\n```\n\n#### Email domains\nYou can change the email domains that can login using Google. The three available options are:\n- `allowed`-array: only the domains in this array can login using Google\n- `disabled`-array: domains in this array can not login using Google\n- Empty / null: all domains can use the Google login\n\n``` php\n    'domains' =\u003e [\n        //'allowed' =\u003e ['statik.be'],\n        //'disabled' =\u003e ['google.com'],\n    ],\n```\n\nYou can add an extra middleware on the auth logins by adding them in the `google-authenticate.php` config file.\n#### Custom middlewares\n``` php\n    'middleware' =\u003e [\n        'web',\n        CustomMiddleware::class\n    ], \n```\n\n#### User table\nYou can customize how a user is saved. The config array `user_columns` will create the fillable data for your user. \nThe array keys are your user column names, the array values are what should be stored. (Make sure the value is an array).\nYou can add multiple values per key, these will be glued together.\nThe following values would be filled by google's returned data, before being glued.\n\n``` php\nconst GOOGLE_VALUES = [\n        'name',\n        'email_verified',\n        'email',\n        'given_name',\n        'family_name',\n        'picture',\n        'nickname',\n        'locale',\n];\n```\nFor example in your config:\n``` php\n'user_columns' =\u003e [\n        'name' =\u003e ['name', ' (', 'locale', ')']     // John Doe (en)\n        'email_verified_at' =\u003e ['email_verified'],  // 2019-10-23 14:31:50\n        'email' =\u003e ['email'],                       // john@doe.com\n        'other data' =\u003e ['blablabla'],              // blablabla\n]\n```\n\n## Publishing\nYou can publish the views and translations files using:\n``` shell\nphp artisan vendor:publish --provider=\"Statikbe\\\\GoogleAuthenticate\\\\GoogleAuthenticateServiceProvider\" --tag=\"google-views\"\n```\nand \n``` shell\nphp artisan vendor:publish --provider=\"Statikbe\\\\GoogleAuthenticate\\\\GoogleAuthenticateServiceProvider\" --tag=\"google-lang\"\n```\n\n## Security\n\nIf you discover any security related issues, please email [info@statik.be](mailto:info@statik.be) instead of using the issue tracker.\n\n## License\n\nThe MIT License (MIT). Please see [License file](license.md) for more information.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatikbe%2Flaravel-google-authenticate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatikbe%2Flaravel-google-authenticate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatikbe%2Flaravel-google-authenticate/lists"}