M
M
Maxim2021-07-06 14:44:48
Vue.js
Maxim, 2021-07-06 14:44:48

Why does authorization fail?

Tell me, set a proxy

axios: {
    proxy: true,
    debug: false,
    browserBaseURL: '/api',
  },

  proxy: {
    '/api': {
      target: process.env.API_URL,
    },
  },


and when the page is refreshed, the authorization flies and redirects to the login page, when you re-login, nothing happens, but the data is pulled out from the api?

Has anyone had such a problem? auth-next v5

auth: {
    cookie: false,
    strategies: {
      'laravelJwt': {
        provider: 'laravel/jwt',
        url: '/v1',
        redirect: {
          login: '/login',
          logout: '/login',
          callback: '/',
          home: '/',
        },
        endpoints: {
          login: {
            url: '/auth/login',
            method: 'post',
            propertyName: 'token',
          },
          logout: { url: '/auth/logout', method: 'post' },
          refresh: { url: '/auth/refresh', method: 'post' },
          user: { url: '/auth/me', method: 'post' },
        },
        token: {
          property: 'access_token',
          maxAge: 60 * 60,
        },
        refreshToken: {
          maxAge: 20160 * 60,
        },
      },
    },
  },


and periodically pops up

HPM] Error occurred while proxying request 127.0.0.1:3080/api/v1/auth/me to https://site.ru/ [ECONNRESET] (https://nodejs.org/api/errors.html#errors_common_system_errors)


I have access to api https://site.ru/api

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kuznetsov, 2021-07-06
@dima9595

The problem is most likely not in the API, but in the states. Those. you do not save the state that the user is logged in. Accordingly, the user, after updating the page, is cleared.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question