{"id":19423227,"url":"https://github.com/atomjoy/laravel-socialite","last_synced_at":"2026-05-15T04:37:08.587Z","repository":{"id":240893240,"uuid":"803688139","full_name":"atomjoy/laravel-socialite","owner":"atomjoy","description":"Google and Github Login with Laravel Socialite (Tutorial).","archived":false,"fork":false,"pushed_at":"2024-05-21T18:14:35.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-19T04:19:12.906Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","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-21T07:47:54.000Z","updated_at":"2024-05-21T18:20:44.000Z","dependencies_parsed_at":"2025-12-09T06:08:28.292Z","dependency_job_id":null,"html_url":"https://github.com/atomjoy/laravel-socialite","commit_stats":null,"previous_names":["atomjoy/socialite-google","atomjoy/laravel-socialite"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/atomjoy/laravel-socialite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Flaravel-socialite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Flaravel-socialite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Flaravel-socialite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Flaravel-socialite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atomjoy","download_url":"https://codeload.github.com/atomjoy/laravel-socialite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Flaravel-socialite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33054055,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-15T02:00:06.351Z","response_time":103,"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-laravel","google-login-button","google-login-laravel","laravel-github-login","laravel-google-login","laravel-social-login","laravel-socialite"],"created_at":"2024-11-10T13:37:29.250Z","updated_at":"2026-05-15T04:37:08.551Z","avatar_url":"https://github.com/atomjoy.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Socialite (Tutorial)\n\nHow to add Google and Github login using Socialite in Laravel. Google One Tap with Vue and Laravel Socialite.\n\n## Install\n\n- composer require laravel/socialite\n- Add local domain host example.org and enable domain SSL in xampp virtualhost (for callbacks and js) or try with localhost\n- Windows local domain and virtualhost in xampp https://github.com/atomjoy/xampp\n\n## Google project\n\n\u003chttps://console.cloud.google.com/projectcreate\u003e\n\n## Google OAuth consent screen\n\nCreate a consent screen for an app with permissions to:\n\n- auth/userinfo.email\n- auth/userinfo.profile\n- openid\n\n## Google oauth keys\n\nCreate external OAuth 2.0 client IDs and retrieve keys\n\n\u003chttps://console.cloud.google.com/apis/credentials\u003e\n\n## Github new app oauth keys\n\n\u003chttps://github.com/settings/developers\u003e\n\n## Setings\n\n.env file\n\n```sh\nGOOGLE_CLIENT_ID=\nGOOGLE_CLIENT_SECRET=\nGOOGLE_REDIRECT_URL=https://example.org/oauth/google/callback\nGOOGLE_HOME_URL=/\n\nGITHUB_CLIENT_ID=\nGITHUB_CLIENT_SECRET=\nGITHUB_REDIRECT_URL=https://example.org/oauth/github/callback\nGITHUB_HOME_URL=/\n```\n\n## Config\n\nconfig/services.php\n\n```sh\n'google' =\u003e [\n    'client_id' =\u003e env('GOOGLE_CLIENT_ID'),\n    'client_secret' =\u003e env('GOOGLE_CLIENT_SECRET'),\n    'redirect' =\u003e env('GOOGLE_REDIRECT_URL'),\n    'homepage' =\u003e env('GOOGLE_HOME_URL'),\n],\n\n'github' =\u003e [\n\t'client_id' =\u003e env('GITHUB_CLIENT_ID'),\n\t'client_secret' =\u003e env('GITHUB_CLIENT_SECRET'),\n\t'redirect' =\u003e env('GITHUB_REDIRECT_URL'),\n\t'homepage' =\u003e env('GITHUB_HOME_URL'),\n],\n\n// Set allowed drivers here or update checkDriver() in OauthLoginController\n'oauth_drivers' =\u003e ['github', 'google'], \n```\n\n## Routes\n\n```php\n\u003c?php\n\nuse Illuminate\\Support\\Facades\\Route;\nuse App\\Http\\Controllers\\OauthLoginController;\n\nRoute::get('/oauth/{driver}/redirect', [OauthLoginController::class, 'redirect']);\nRoute::get('/oauth/{driver}/callback', [OauthLoginController::class, 'callback']);\nRoute::get('/oauth/{driver}/logout', [OauthLoginController::class, 'logout']);\nRoute::get('/oauth/{driver}/oauth', [OauthLoginController::class, 'oauth']);\n```\n\n## Controllers\n\nCopy OauthLoginController.php controller to app/Http/Controllers\n\n## Login button\n\n```blade\n\u003c?php\n@if (Auth::check())\n    \u003cdiv\u003e{{ Auth::user()-\u003ename }}\u003c/div\u003e\n    \u003ca href=\"/oauth/google/logout\"\u003eLogout\u003c/a\u003e\n@else\n    \u003ca href=\"/oauth/google/redirect\"\u003eLogin with Google\u003c/a\u003e\n    \u003ca href=\"/oauth/github/redirect\"\u003eLogin with Github\u003c/a\u003e\n@endif\n```\n\n## Javascript Google One Tap and button (optional)\n\n```html\n@if (!Auth::check())\n\u003cdiv id=\"buttonDiv\"\u003e\u003c/div\u003e\n\u003cscript src=\"https://accounts.google.com/gsi/client\" async defer\u003e\u003c/script\u003e\n\u003cscript\u003e\n\tfunction handleCredentialResponse(response) {\n\t\twindow.location.href = '/oauth/google/redirect'\n\t\t// window.location.href = '/oauth/google/oauth?token=' + response.credential\n\t\t// Here we can do whatever process with the response we want\n\t\t// Note that response.credential is a JWT ID token\n\t\t// console.log(\"Encoded JWT ID token: \" + response.credential);\n\t}\n\t\n\twindow.onload = function () {\n\t\tgoogle.accounts.id.initialize({\n\t\t\tclient_id: \"{{ config('services.google.client_id') }}\", // Or replace with your Google Client ID\n\t\t\tcallback: handleCredentialResponse // We choose to handle the callback in client side, so we include a reference to a function that will handle the response\n\t\t});\n\n\t\t// Show \"Sign-in\" button (optional)\n\t\tgoogle.accounts.id.renderButton(document.getElementById(\"buttonDiv\"),{ theme: \"outline\", size: \"small\" });\n\t\t// Display the One Tap dialog\n\t\tgoogle.accounts.id.prompt();\n\t\t// Hide One Tap onclick\n\t\tconst button = document.querySelector('body');\n\t\t// Event\n\t\tbutton.onclick = () =\u003e {\n\t\t\tgoogle.accounts.id.disableAutoSelect();\n\t\t\tgoogle.accounts.id.cancel();\n\t\t}\n\t}\n\u003c/script\u003e\n@endif\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomjoy%2Flaravel-socialite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatomjoy%2Flaravel-socialite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomjoy%2Flaravel-socialite/lists"}