https://github.com/bhadresh-laiya/api-auth-wizard
How to do a RESTful API in Laravel 5.5 with authentication by email and password using Laravel Passport (OAuth 2.0)
https://github.com/bhadresh-laiya/api-auth-wizard
api authentication backend backend-api laravel laravel-authentication laravel-framework laravel-passport passport php phpmyadmin
Last synced: 3 months ago
JSON representation
How to do a RESTful API in Laravel 5.5 with authentication by email and password using Laravel Passport (OAuth 2.0)
- Host: GitHub
- URL: https://github.com/bhadresh-laiya/api-auth-wizard
- Owner: bhadresh-laiya
- Created: 2019-02-09T07:57:00.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-09T08:21:17.000Z (about 6 years ago)
- Last Synced: 2024-12-28T22:51:38.721Z (4 months ago)
- Topics: api, authentication, backend, backend-api, laravel, laravel-authentication, laravel-framework, laravel-passport, passport, php, phpmyadmin
- Language: PHP
- Size: 175 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel Api Authentication wizard!
How to do a RESTful API in Laravel 5.5 with authentication by email and password using Laravel Passport (OAuth 2.0)### Prerequisites
* Apache
* PHP
* Composer
* Envirenment for deploy project### Step 1 - Clone this Repo
### Step 2 - Run composer install
```
composer install
```### Step 3 - Create database and makes changes into following file
```
.env
```### Step 4 - Run migrations
```
php artisan migrate
```### Step 5 - Install Laravel Passport
```
php artisan passport:install
```
### Step 6 - Modify Mail config field into .env file
```
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
```### Step 7 - Test API endpoints using CURL or Using REST Client tool or extension(like Postman, Mozilla Rest Client, etc.)
Register```
http://localhost/api-auth-wizard/api/register?name=your_name&email=your_email_address&password=your_password
``````
curl -X POST -H 'Accept: application/json' -d 'name=your_name&email=your_email_address&password=your_password&password_confirmation=your_password' http://localhost/api-auth-wizard/api/register```
Login
```
http://localhost/api-auth-wizard/api/login?email=your_email_address&password=your_password
``````
curl -X POST -H 'Accept: application/json' -d 'email=your_email_address&password=your_password' http://localhost/api-auth-wizard/api/login
```Verify Email
```
http://localhost/api-auth-wizard/api/user/verify/{email_token}
``````
curl -X POST -H 'Accept: application/json' -d 'token={email_token}' http://localhost/api-auth-wizard/api/user/verify
```Logout
```
http://localhost/api-auth-wizard/api/logout?token={after_login_token}
``````
curl -H 'Accept: application/json' -H 'Authorization: Bearer token_generated_on_register_or_login' http://localhost/api-auth-wizard/api/logout
```