{"id":20471410,"url":"https://github.com/bitfumes/laravel-api-auth","last_synced_at":"2026-02-22T09:43:04.892Z","repository":{"id":62494589,"uuid":"199157049","full_name":"bitfumes/laravel-api-auth","owner":"bitfumes","description":"create api auth using JWT in just 1 minute","archived":false,"fork":false,"pushed_at":"2023-03-21T06:07:02.000Z","size":60,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-17T17:03:48.370Z","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/bitfumes.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-07-27T11:37:36.000Z","updated_at":"2022-02-09T08:38:41.000Z","dependencies_parsed_at":"2025-04-13T11:14:46.385Z","dependency_job_id":null,"html_url":"https://github.com/bitfumes/laravel-api-auth","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/bitfumes/laravel-api-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfumes%2Flaravel-api-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfumes%2Flaravel-api-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfumes%2Flaravel-api-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfumes%2Flaravel-api-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitfumes","download_url":"https://codeload.github.com/bitfumes/laravel-api-auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfumes%2Flaravel-api-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29708363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T05:59:28.568Z","status":"ssl_error","status_checked_at":"2026-02-22T05:58:46.208Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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-11-15T14:16:02.579Z","updated_at":"2026-02-22T09:43:04.877Z","avatar_url":"https://github.com/bitfumes.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# api-auth\n\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![GitHub issues](https://img.shields.io/github/issues/bitfumes/laravel-api-auth)](https://github.com/bitfumes/laravel-api-auth/issues)\n[![Total Downloads](https://img.shields.io/packagist/dt/bitfumes/api-auth.svg?style=flat-square)](https://packagist.org/packages/bitfumes/api-auth)\n[![Build Status](https://travis-ci.org/bitfumes/laravel-api-auth.svg?branch=master)](https://travis-ci.org/bitfumes/laravel-api-auth)\n\n# Install\n\n`composer require bitfumes/api-auth`\n\n# Steps to follow\n\n## Steps 1\n\n1. Add Contract `hasApiAuth` and `JWTSubject` to your authenticatable model like shown below:\n2. Add `ApiAuth` trait to your user model.\n\n```php\n\nuse Bitfumes\\ApiAuth\\Traits\\ApiAuth;\nuse Tymon\\JWTAuth\\Contracts\\JWTSubject;\nuse Bitfumes\\ApiAuth\\Contract\\HasApiAuth;\n\nclass User extends Authenticatable implements HasApiAuth, JWTSubject\n{\n    use Notifiable, ApiAuth;\n    ...\n}\n```\n\n## Step 2\n\nConfigure your config/auth.php file to update guard details\n\n- Update default guard to api\n\n```php\n'defaults' =\u003e [\n        'guard'     =\u003e 'api',\n        ...\n    ],\n```\n\n- Update api guard to 'jwt'\n\n```php\n'guards' =\u003e [\n        ... ,\n\n        'api' =\u003e [\n            'driver'   =\u003e 'jwt',\n            ...\n        ],\n    ],\n```\n\n## Step 3\n\nAdd new accessor to your authenticatable model\n\n```php\npublic function setPasswordAttribute($value)\n{\n    $this-\u003eattributes['password'] = bcrypt($value);\n}\n```\n\n## Step 4\n\nNow publish two new migrations\n\n1.  To add avatar field to your use model.\n2.  To add social login profile.\n\n```bash\nphp artisan vendor:publish --tag=api-auth:migrations\n```\n\n## Step 5\n\nAfter getting migrations in your laravel application, its time to have these tables in your database.\n\n```bash\nphp artisan migrate\n```\n\n## Step 6\n\nBecause every user need to verify its email and to send email we are going to use laravel queue.\n\nNow add queue driver on your `.env` file\n\nThat's it, now enjoy api auth with JWT\n\n```\nQUEUE_DRIVER=database\n```\n\n## Testing\n\nRun the tests with:\n\n```bash\nvendor/bin/phpunit\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security\n\nIf you discover any security-related issues, please email sarthak@bitfumes.com instead of using the issue tracker.\n\n## License\n\nThe MIT License (MIT). Please see [License File](/LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfumes%2Flaravel-api-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitfumes%2Flaravel-api-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfumes%2Flaravel-api-auth/lists"}