Переопределить параметры стратегии модуля Nuxt. js auth - PullRequest
0 голосов
/ 06 апреля 2020

Есть ли способ переопределить Nuxt. js Конфигурация стратегий модуля auth? Например, можно ли переместить параметр redirect_uri из nuxt.config.js в метод в pages/index.vue.

Настройка аутентификации в nuxt.config.js:

  auth: {
    strategies: {
      'laravel.passport': {
        url: 'http://laravel.test',
        client_id: 2,
        client_secret: 'S0gpcgfIDgbvIHCL3jIhSICAiTsTUMOR0k5mdaCi',
        redirect_uri: 'http://localhost:3000'
      }
    }
  }

Метод входа в pages/index.vue:

async login () {
  await this.$auth.loginWith('laravel.passport', {
    data: {
      // All the 3 parameters below don't seem to be taken into account.
      username: 'me@home.com',
      password: '1qaz@WSX',
      // If 'redirect_uri' is removed from 'nuxt.config.js'
      // and moved below, logging in returns an error.
      redirect_uri: 'http://localhost:3000'
    }
  }).then((r) => {
    console.log(r)
  }).catch((e) => {
    console.log(e)
  })
}
...