I'm trying to get a new access token sending a post request to server. I'm using postman to send the refresh token and the function that handles this is bellow this paragraph. The server response is E_INVALID_JWT_REFRESH_TOKEN
async refresh({
request,
response,
auth
}) {
try {
const refresh_token = request.input('refresh_token')
const decrypted = Encryption.decrypt(refresh_token)
console.log(decrypted)
const token = await auth.generateForRefreshToken(refresh_token, true)
console.log('Token is',token)
return response.status(200).json(token)
} catch (error) {
return response.status(401).json(error)
}
}
As you can see, I decrypted the token and it's ok. Also check the database and is ok.
Apparently I'm not the only one that have this error and an issue is closed in GitHub
UPDATE:
This is my config/auth.js
jwt: {
serializer: 'LucidMongo',
model: 'App/Models/User',
scheme: 'jwt',
uid: 'email',
password: 'password',
options: {
secret: Env.get('APP_KEY'),
expiresIn: '60m',
}
},