{"id":19423226,"url":"https://github.com/atomjoy/socialites","last_synced_at":"2026-01-06T02:04:26.435Z","repository":{"id":240977971,"uuid":"803976079","full_name":"atomjoy/socialites","owner":"atomjoy","description":"How to add Google and Github login button using Socialite in Laravel. Google One Tap with Vue and Laravel Socialite.","archived":false,"fork":false,"pushed_at":"2024-05-25T16:04:19.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-03T02:15:12.535Z","etag":null,"topics":["github-login-button","github-login-button-vue3-laravel","github-login-laravel","google-login-button","google-login-button-vue3-laravel","google-one-tap","laravel-github-login","laravel-google-login","laravel-socialite"],"latest_commit_sha":null,"homepage":"https://github.com/atomjoy/socialites","language":"Blade","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atomjoy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-05-21T18:07:37.000Z","updated_at":"2024-05-25T16:03:08.000Z","dependencies_parsed_at":"2024-05-21T19:23:46.308Z","dependency_job_id":"7613de2a-96d9-46c0-96b8-2e6c497a1bfe","html_url":"https://github.com/atomjoy/socialites","commit_stats":null,"previous_names":["atomjoy/socialites"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/atomjoy/socialites","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fsocialites","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fsocialites/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fsocialites/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fsocialites/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atomjoy","download_url":"https://codeload.github.com/atomjoy/socialites/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fsocialites/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28220455,"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":"2026-01-06T02:00:07.049Z","response_time":56,"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":["github-login-button","github-login-button-vue3-laravel","github-login-laravel","google-login-button","google-login-button-vue3-laravel","google-one-tap","laravel-github-login","laravel-google-login","laravel-socialite"],"created_at":"2024-11-10T13:37:29.210Z","updated_at":"2026-01-06T02:04:26.399Z","avatar_url":"https://github.com/atomjoy.png","language":"Blade","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google and Github Login with Laravel Socialite\r\n\r\nHow to add Google and Github login using Socialite in Laravel. Google One Tap with Vue and Laravel Socialite.\r\n\r\n## Install\r\n\r\nAdd package and routes.\r\n\r\n```sh\r\ncomposer require \"atomjoy/socialites\"\r\n```\r\n\r\n## Callbacks and local domain\r\n\r\nChange the callback domain, set the local domain to example.org and add ssl.\r\n\r\n```sh\r\n# Google callback\r\nhttps://example.org/oauth/google/callback\r\n\r\n# Github callback\r\nhttps://example.org/oauth/github/callback\r\n\r\n# How to set local domain and SSL for example.org (xampp)\r\nhttps://github.com/atomjoy/xampp\r\n```\r\n\r\n## Create Google project\r\n\r\n\u003chttps://console.cloud.google.com/projectcreate\u003e\r\n\r\n## Create Google OAuth consent screen\r\n\r\nCreate a consent screen for an app with permissions to:\r\n\r\n- auth/userinfo.email\r\n- auth/userinfo.profile\r\n- openid\r\n\r\n## Create Google oauth keys\r\n\r\nCreate **External** OAuth 2.0 client IDs add callback and retrieve keys\r\n\r\n\u003chttps://console.cloud.google.com/apis/credentials\u003e\r\n\r\n## Create a new oauth app on Github and get the keys\r\n\r\n\u003chttps://github.com/settings/developers\u003e\r\n\r\n## Setings\r\n\r\nUpdate the .env file in the callback links, just change the domain.\r\n\r\n```sh\r\nGOOGLE_CLIENT_ID=\r\nGOOGLE_CLIENT_SECRET=\r\nGOOGLE_REDIRECT_URL=https://example.org/oauth/google/callback\r\nGOOGLE_HOME_URL=/\r\n\r\nGITHUB_CLIENT_ID=\r\nGITHUB_CLIENT_SECRET=\r\nGITHUB_REDIRECT_URL=https://example.org/oauth/github/callback\r\nGITHUB_HOME_URL=/\r\n```\r\n\r\n## Config service\r\n\r\nAppend in config/services.php\r\n\r\n```php\r\n\u003c?php\r\n\r\nreturn [\r\n    'google' =\u003e [\r\n        'client_id' =\u003e env('GOOGLE_CLIENT_ID'),\r\n        'client_secret' =\u003e env('GOOGLE_CLIENT_SECRET'),\r\n        'redirect' =\u003e env('GOOGLE_REDIRECT_URL'),\r\n        'homepage' =\u003e env('GOOGLE_HOME_URL'),\r\n    ],\r\n\r\n    'github' =\u003e [\r\n        'client_id' =\u003e env('GITHUB_CLIENT_ID'),\r\n        'client_secret' =\u003e env('GITHUB_CLIENT_SECRET'),\r\n        'redirect' =\u003e env('GITHUB_REDIRECT_URL'),\r\n        'homepage' =\u003e env('GITHUB_HOME_URL'),\r\n    ],\r\n\r\n    'oauth_drivers' =\u003e ['github', 'google']\r\n];\r\n```\r\n\r\n## Login buttons\r\n\r\nreturn view('socialites::login-buttons');\r\n\r\n```html\r\n@if (Auth::check())\r\n    \u003cdiv\u003e{{ Auth::user()-\u003ename }}\u003c/div\u003e\r\n    \u003ca href=\"/oauth/logout\" title=\"Logout\"\u003e{{ trans('Logout') }}\u003c/a\u003e\r\n@else\r\n    \u003ca href=\"/oauth/google/redirect\" title=\"Google\"\u003e{{ trans('Login with Google') }}\u003c/a\u003e\r\n    \u003ca href=\"/oauth/github/redirect\" title=\"Github\"\u003e{{ trans('Login with Github') }}\u003c/a\u003e\r\n@endif\r\n```\r\n\r\n## Javascript Google One Tap dialog and button (optional)\r\n\r\nreturn view('socialites::login-onetap');\r\n\r\n```html\r\n@if (!Auth::check())\r\n\u003cdiv id=\"buttonDiv\"\u003e\u003c/div\u003e\r\n\u003cscript src=\"https://accounts.google.com/gsi/client\" async defer\u003e\u003c/script\u003e\r\n\u003cscript\u003e\r\n    function handleCredentialResponse(response) {\r\n        window.location.href = '/oauth/google/redirect'\r\n        // Here we can do whatever process with the response we want (optional)\r\n        // Note that response.credential is a JWT ID token\r\n        // console.log(\"Encoded JWT ID token: \" + response.credential);\r\n        // fetch('/oauth/google/oauth?token=' + response.credential)\r\n    }\r\n\r\n    window.onload = function () {\r\n        google.accounts.id.initialize({\r\n            client_id: \"{{ config('services.google.client_id') }}\", // Or replace with your Google Client ID\r\n            callback: handleCredentialResponse // We choose to handle the callback in client side, so we include a reference to a function that will handle the response\r\n        });\r\n        // Show \"Sign-in\" button (optional)\r\n        // google.accounts.id.renderButton(document.getElementById(\"buttonDiv\"),{ theme: \"outline\", size: \"small\" });\r\n        // Display the One Tap dialog\r\n        google.accounts.id.prompt();\r\n        // Hide One Tap onclick\r\n        const button = document.querySelector('body');\r\n        button.onclick = () =\u003e {\r\n            google.accounts.id.disableAutoSelect();\r\n            google.accounts.id.cancel();\r\n        }\r\n    }\r\n\u003c/script\u003e\r\n@endif\r\n```\r\n\r\n## Run server\r\n\r\n```sh\r\nphp artisan serve --host=localhost --port=8000\r\n```\r\n\r\n## Publish assets\r\n\r\n```sh\r\n# Copy Icons\r\nphp artisan vendor:publish --tag=socialites-assets --force\r\n\r\n# Edit Views\r\nphp artisan vendor:publish --tag=socialites-views --force\r\n\r\n# Create config example config/socialites.php\r\nphp artisan vendor:publish --tag=socialites-config --force\r\n```\r\n\r\n## Events\r\n\r\n```php\r\n\u003c?php\r\n\r\nuse Atomjoy\\Socialites\\Events\\UserLogged;\r\nuse Atomjoy\\Socialites\\Events\\UserCreated;\r\n```\r\n\r\n## Add more drivers in the configuration file\r\n\r\nAppend in config/services.php\r\n\r\n```php\r\n\u003c?php\r\n\r\nreturn [\r\n    //...\r\n\r\n    'facebook' =\u003e [\r\n        'client_id' =\u003e env('FACEBOOK_CLIENT_ID'),\r\n        'client_secret' =\u003e env('FACEBOOK_CLIENT_SECRET'),\r\n        'redirect' =\u003e env('FACEBOOK_REDIRECT_URL'),\r\n        'homepage' =\u003e env('FACEBOOK_HOME_URL'),\r\n    ],\r\n\r\n    'oauth_drivers' =\u003e ['github', 'google', 'facebook'],\r\n];\r\n```\r\n\r\n## LICENSE\r\n\r\nThis project is licensed under the terms of the GNU GPLv3 license.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomjoy%2Fsocialites","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatomjoy%2Fsocialites","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomjoy%2Fsocialites/lists"}