1
votes

i'm building cross-platform app so i have website and mobile app. also I've Authentication part for both website and app.

and i'm using Laravel As backend. For auth i found something called "Auth Guards" and there are two default Auth guard in Laravel, one for web and other for API.

But i'm a bit confused cause i found that you can't use both Auth Guards at the same time.

So, is there any way to build authentication system based in one Database Table For Website an Mobile.

NOTE i need any solution except Firebase Auth

Auth.php

/*
    |--------------------------------------------------------------------------
    | Authentication Defaults
    |--------------------------------------------------------------------------
    |
    | This option controls the default authentication "guard" and password
    | reset options for your application. You may change these defaults
    | as required, but they're a perfect start for most applications.
    |
    */

    'defaults' => [
        'guard' => 'web',
        'passwords' => 'users',
    ],
1
these guards both use the same user information (same model and database table)... they just authenticate the request in a different way (one uses the session and one uses a request token) but both use the same exact users (if you haven't changed the user provider in the configuration for each)lagbox
i know but in Auth.php you can only choose one, and if you choose one the the other wouldn't workuser13777183
in Auth.php ? ... what version of Laravel are you using?lagbox
i'm using Laravel 7user13777183
so what Auth.php file are you referring to? when you assign the auth middleware you can actually pass it as many guards as you want btw and it will loop through them (middleware parameters) though not sure if that is what you needlagbox

1 Answers

0
votes

a good solution could be laravel oficial pakage laravel/passport that offer you oauth2 so you can implement it on android/os easly.