[Vuejs]-How do I access the auth information when I use router.get('/me', (res,req) => {})

0👍

Don’t worry. I got it working… I had to change

 auth: {
    strategies: {
      local: {
        endpoints: {
          login: { url: 'auth/login', method: 'post', propertyName: 'data.token' },
          user: { url: 'auth/user', method: 'get', propertyName: false },
          logout: false
        }
      }
    },
}

to

 auth: {
    strategies: {
      local: {
        endpoints: {
          login: { url: 'auth/login', method: 'post', propertyName: 'token' },
          user: { url: 'auth/user', method: 'get', propertyName: false },
          logout: false
        }
      }
    },
}

My localstorage kept getting ‘Bearer%undefined’ instead of ‘Bearer tokenkeystring’ because my login payload returned

{
success: true,
token: 'tokenkeystring'
}

instead of

{
success:true,
data:
  {
    token: 'tokenkeystring'
  }
}

Leave a comment