#Login with Token doesn't work properly in Fortify

2 messages · Page 1 of 1 (latest)

marsh idol
#

So I use a fortify for logging in and out. The problem that I have is that when I log in and out of Postman, it is working properly, but when I use a browser, it creates the token successfully but when I use the token to the POST headers, it says unauthenticated

I am using Vue 3 and axios to connect my FE to BE.

I have tried logging in on Postman to create the token, copy pasted in on the headers of the logout in axios it works fine

  console.log(localStorage.getItem('token'))
  axios({url: '/logout', method: "POST", headers: {'Authorization': 'Bearer 12|v5amotUSRiZyZLsB8tlBRke4xUQrJtVc9QQj9UNg',
      'Accept': 'application/json'}}
  )
    .then(response => {
      if (response.status == 200){
        console.log(response)
        // handle success
        localStorage.removeItem('token')
        console.log("Success logout!")
        router.push({name: 'login'})
      }
    })
    .catch(error => {
      console.log(error)
      // handle error
    })

}```

But when I use the token created by logging in using browser, it says `unauthenticated`

Did anyone had this issue? Please help. Thank you
green cobalt
#

Could you please just have a little patience instead of reposting the same thing in multiple channels? People will help you when they can, and it's not like you're guaranteed to have a reply within an hour