Download the PHP package waqar/apiauthentication without Composer
On this page you can find all versions of the php package waqar/apiauthentication. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download waqar/apiauthentication
More information about waqar/apiauthentication
Files in waqar/apiauthentication
Package apiauthentication
Short Description A simple modified api authentication
License MIT
Informations about the package apiauthentication
Laravel API Authentication
This is a Laravel package that provides easy-to-use API authentication using Laravel Passport. The package comes with pre-built controllers, middleware, and routes for registering users, authenticating users, and send opt on mail and phone number.
Features
- Register new users
- Authenticate existing users
- Pre-built controllers, and routes for easy integration into your Laravel application
- Send otp on mail and phone number
Installation package
To install the package, run the following command:
Install Laravel Passport
Next, you should execute the passport:install Artisan command
Finally, in your application's config/auth.php
configuration file, you should define an api
authentication guard and set the driver
option to passport
. This will instruct your application to use Passport's TokenGuard
when authenticating incoming API requests:
For more information please visit the link: Laravel Passport
Config file
- Add the service provider to
app/config/app.php
Step 2: Setup Database Configuration
After successfully installing the laravel app then after configuring the database setup. We will open the ".env" file and change the database name, username and password in the env file.
Now, run migration with following command:
Configure sender mail address in laravel .env file
.env file:
Create Twilio Account
First you need to create and add phone number. then you can easily get account SID, Token and Number.
Create Account from here: www.twilio.com.
Next add Twilio Phone Number
Next you can get account SID, Token and Number and add these in the .env file like bellow:
.env
Usage
The package comes with pre-built controllers, and routes for registering users, authenticating users. To use these features, simply include the package's routes in your Laravel application's routes/api.php file:
You can then make API requests to the following endpoints:
/api/register
: Register a new user/api/login
: Authenticate an existing user and retrieve an access token/api/sendOtpEmail
: send otp on mail/api/sendOtpPhoneNumber
: send otp on phone number/api/verifyOtp
: Verify otp
Note
Please add Accept:application/json
in headers