title: Need advice and information about Laravel Jwt multiple role auth with Nuxt.js
body: <p>Im currently learning about Laravel Jwt auth with nuxt.js. since I only successfully created single role auth, I don’t have enough experience about this so I want to ask some questions about it.</p>
  <ol>
  <li><p>what is the orthodox methods or ways to implements multi role Laravel Jwt auth with nuxt.js?  </p>
  <p>article: <a href="https://medium.com/@JinoAntony/multi-user-api-authentication-using-laravel-jwt-8ae572b0c4cf" rel="nofollow noreferrer">https://medium.com/@JinoAntony/multi-user-api-authentication-using-laravel-jwt-8ae572b0c4cf</a></p>
  <p>im reading this article which make me confused. In this article the author implementing the auth in irregular ways in my opinion. The author make login controller, model, table ,guard etc of every role he need. In example if he has 3 role (admin, user, superadmin) so he make admin table, model, controller etc also on user and superadmin. most authentication methods i've seen manage the auth in 1 user controller, 1 user table which contains role fields , 1 user model etc. if you dont mind to suggest me any article about laravel multiple auth with jwt. disclaimer, I don't blame the author, I just feel the way it's implemented is irregular.</p>
  </li>
  <li><p>Asuming im using the author methods, but how to do request to 3 different login controller in one login page with nuxt.js or I should make 3 different login page to make it work?</p>
  </li>
  </ol>
  <p>lets say I have nuxt auth scheme like code below</p>
  <pre><code>  auth: {
  strategies: {
    user: {
      _scheme: 'local',
      token: {
              property: 'token',
              required: true,
              type: 'Bearer'
      },
      endpoints: {
        login: { url: '/api/auth/user/login', method: 'post', propertyName: 'token' },
        logout: { url: '/api/auth/user/logout', method: 'post' },
        user: { url: '/api/auth/user/user', method: 'get', propertyName: 'user' }
      },
    },
    admin: {
      _scheme: 'local',
      token: {
          property: 'token',
          required: true,
          type: 'Bearer'
      },
      login: { url: '/api/auth/admin/login', method: 'post', propertyName: 'token' },
      logout: { url: '/api/auth/admin/logout', method: 'post' },
      user: { url: '/api/auth/admin/user', method: 'get', propertyName: 'user' }
    },
  
  }}
  </code></pre>
  <p>and login methods like code below:</p>
  <pre><code>    methods: {
    async login() {
  
      await this.$auth.loginWith('local', {
          data: {
            email: this.user.email,
            password: this.user.password
          }
        })
  
        .then(() =&gt; {
  
          //redirect
          this.$router.push({
            name: 'admin-dashboard'
          })
  
        })
  
        .catch(error =&gt; {
          //assign validation
          this.validation = error.response.data
        })
    }
  </code></pre>
  <p>should i make every ROLE login methods in different page?</p>
  <p>and lets say I has every role login controller like below:</p>
  <pre><code>$credentials = $request-&gt;only('email', 'password');
  
      if(!$token = auth()-&gt;guard('api')-&gt;attempt($credentials)) {
  
          //response login &quot;failed&quot;
          return response()-&gt;json([
              'success' =&gt; false,
              'message' =&gt; 'Email or Password is incorrect'
          ], 401);
  
      }
      
      //response login &quot;success&quot; with generate &quot;Token&quot;
      return response()-&gt;json([
          'success' =&gt; true,
          'user'    =&gt; auth()-&gt;guard('api')-&gt;user(),  
          'token'   =&gt; $token
      ], 200);
  </code></pre>