Get scopes in Nuxt Auth with Laravel passport password grant type

  laravel, laravel-passport, nuxt-auth, nuxt.js, oauth

I want to return the scopes base on user role when nuxt auth requesting token in default localhost:3000/_auth/laravelPassport/token.

here’s the nuxt.config.js auth strategy setup

strategies: {
  laravelPassportPasswordGrant: {
    name: 'laravelPassport',
    provider: 'laravel/passport',
    url: process.env.API_URL,
    endpoints: {
      logout: '/api/auth/logout',
      user: {
        url: '/api/auth/user',
    clientId: process.env.PASSPORT_CLIENT_ID,
    clientSecret: process.env.PASSPORT_CLIENT_SECRET,
    grantType: 'password',

My Laravel boot function in appProvidersAuthServiceProvider.php

public function boot()
        'admin' => 'Get admin resources',
        'user' => 'Get user resources'

The nuxt auth laravel passport password default request token from /oauth/token
how can I do insert scope when the authenticate pass?
Thanks in advance!

Source: Laravel

Leave a Reply