This is an illuminate package for one time authentication (OTP) with OAuth2 Base

v3.0.7 2020-06-01 09:49 UTC


Latest Version on Packagist Total Downloads Build Status StyleCI

This is where your description should go. Take a look at to see a to do list.


Via Composer

$ composer require alive2212/laravel-mobile-passport

if use Laravel < 5.4 add to service provider 'config/app.php'

    'providers' => [
         * Authentication service

if use Lumen add following service provider at then end of 'bootstrap/app.php'


    'namespace' => 'Alive2212\LaravelMobilePassport\Http\Controllers',
], function ($router) {
    require Alive2212\LaravelMobilePassport\LaravelMobilePassport::getDir() .

migrate all database

$ php artisan migrate

add following code into AuthServiceProvider in 'boot' method

public function boot()



    LaravelMobilePassportSingleton::$otpCallBack = function (
        Request $request,
        User $user,
        AliveMobilePassportDevice $device,
    ) {
        // dispach send sms job here to send notification
    LaravelMobilePassportSingleton::$otpConfirmCallBack = function (
        Request $request,
        User $user,
        PersonalAccessTokenResult $token,
        ResponseModel $response
    ) {
        // put somthing here like update user name with request fileds

*tip: if ENV_DEBUG in .env file set to false don't return any data in register by token

add 'phone_number' & 'country_code' into model $fillable variable:

    protected $fillable = [

publish vendor files with following command:

php artisan vendor:publish --tag laravel-mobile-passport.lang
php artisan vendor:publish --tag laravel-mobile-passport.config

User model must be extended from BaseAuthModel

In the next step you should install following package and it's version related to your laravel version.

  • phoenix/eloquent-meta
  • fico7489/laravel-pivot

Add flowing code into app\User.php

     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
    public function roles()
        return $this->belongsToMany(

Finally run following command to install passport dependency

$ art passport:install

Optional for add routes you can put following into boot method at AppServiceProvider

// add mobile passport routes


1- create roles what you want in to alive_mobile_passport_roles *tip: title of roles must unique

You can use following to get current user scopes


Change log

Please see the changelog for more information on what has changed recently.


$ composer test

Relation of this package with another one is:

  • array helper -> nothing
  • laravel excel helper -> nothing
  • laravel onion pattern -> nothing
  • laravel query helper -> nothing
  • laravel reflection helper -> nothing
  • laravel request helper -> nothing
  • laravel string helper -> nothing
  • laravel smart response -> array helper
  • laravel smart restful -> laravel excel helper, laravel onion pattern, laravel query helper, laravel reflection helper, laravel smart response, laravel string helper
  • laravel passport auth -> laravel smart restful


Please see for details and a todolist.


If you discover any security related issues, please email author email instead of using the issue tracker.



license. Please see the license file for more information.