{"id":23384640,"url":"https://github.com/romanturas/passport-laravel","last_synced_at":"2026-01-21T11:02:07.350Z","repository":{"id":224415080,"uuid":"387691567","full_name":"RomanTuras/passport-laravel","owner":"RomanTuras","description":"How to install Laravel 8 passport for using from Vue Js","archived":false,"fork":false,"pushed_at":"2021-07-20T14:40:55.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-08T11:26:17.247Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/RomanTuras.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}},"created_at":"2021-07-20T06:13:05.000Z","updated_at":"2021-07-20T14:40:58.000Z","dependencies_parsed_at":"2024-02-25T21:03:34.055Z","dependency_job_id":null,"html_url":"https://github.com/RomanTuras/passport-laravel","commit_stats":null,"previous_names":["romanturas/passport-laravel"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RomanTuras/passport-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomanTuras%2Fpassport-laravel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomanTuras%2Fpassport-laravel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomanTuras%2Fpassport-laravel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomanTuras%2Fpassport-laravel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RomanTuras","download_url":"https://codeload.github.com/RomanTuras/passport-laravel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomanTuras%2Fpassport-laravel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28632253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-12-21T23:28:37.406Z","updated_at":"2026-01-21T11:02:07.325Z","avatar_url":"https://github.com/RomanTuras.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# How to install and setup passport in Laravel 8 for using from Vue Js\n\n### To install Laravel Passport, run:\n\n```\ncomposer require laravel/passport\n```\n\n### Add the following provider in the config/app.php file:\n\n```php\nLaravel\\Passport\\PassportServiceProvider::class,\n```\n\n### Migrate Laravel Passport tables:\n\n```\nphp artisan migrate\n```\n\n### And then install:\n\n```\nphp artisan passport:install\n```\n\n### And now open `AuthServiceProvider.php` file. Add the following routes and expire time for token:\n\n```php\npublic function boot()\n    {\n        $this-\u003eregisterPolicies();\n\n        Passport::routes();\n\n        Passport::tokensExpireIn(Carbon::now()-\u003eaddDays(15));\n\n        Passport::refreshTokensExpireIn(Carbon::now()-\u003eaddDays(30));\n    }\n```\n\n### And uncomment in the `AuthServiceProvider.php` file:\n\n```php\nprotected $policies = [\n         'App\\Models\\Model' =\u003e 'App\\Policies\\ModelPolicy',\n    ];\n```\n\n### Now open `config/auth.php` file and set passport as your API driver.\n\n```php\n'guards' =\u003e [\n   'web' =\u003e [\n       'driver' =\u003e 'session',\n       'provider' =\u003e 'users',\n   ],\n   'api' =\u003e [\n       'driver' =\u003e 'passport',\n       'provider' =\u003e 'users',\n   ],\n],\n```\n\n### Add provider in the `config/app.php`\n\n```php\n'providers' =\u003e [\n  ...\n  \\Laravel\\Passport\\PassportServiceProvider::class,\n  ]\n```\n\n### Update the Users Model:\n\n```php\nuse HasFactory, Notifiable, HasApiTokens;\n```\n\n### Add `$middlewareGroups` into `app/Http/Kernel.php`:\n\n```php\n'web' =\u003e [\n            ...\n            CreateFreshApiToken::class,\n        ],\n\n        'api' =\u003e [\n            ...\n            CreateFreshApiToken::class,\n        ],\n```\n\n### Edit `app/Http\\Middleware\\VerifyCsrfToken`:\n\n```php\nprotected $except = [\n        \"api/*\"\n    ];\n```\n\n### If adding your routes inside the `web middleware` doesn't work for any reason, then try adding this to `$middleware` into `app/Http/Kernel.php`:\n\n```php\nprotected $middleware = [\n        ...\n        StartSession::class,\n        ShareErrorsFromSession::class,\n    ];\n```\n\n### Try to use middleware in `route/api.php`, for example:\n\n```php\nRoute::middleware('auth:api')-\u003egroup(function () {\n    ...\n});\n```\n\n### Now `X-XSRF-TOKEN` will be added in the header automatically from your Vue Js code\n\n---\n\n### Don't forget about key's (deploy them to prod):\n\n```\nstorage/oauth-private.key\nstorage/oauth-public.key\n```\n\n### And create all `oauth` tables in the remote DB\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromanturas%2Fpassport-laravel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromanturas%2Fpassport-laravel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromanturas%2Fpassport-laravel/lists"}