I have read a lot of articles about refreshing token , but I didn't get nothing , they seems too complicated. Could you please explain me on my sample. I'm making sign-in , on response i'm getting object with access_token, refresh_token and timestamp. After I'm saving both tokens in localStorage. Later when access_token expires I receive 403 error(Forbidden). There is no message that token expired. Could you please help me with that
signIn(event) {
event.preventDefault()
const formdata = new FormData()
formdata.append("username", this.state.userLogin.email)
formdata.append("password", this.state.userLogin.password)
axios
.post("http://dev.****************.com/auth/get-token", formdata)
.then(res => {
if (res.data) {
localStorage.setItem("token", res.data.access_token)
localStorage.setItem("updToken", res.data.update_token)
this.setState({
isLoginError: false,
})
this.props.history.push("/settings")
}
})
.catch(error => {
if (error.response.status === 403) {
this.setState({
isLoginError: true,
})
}
})
}