-
Hi i just implemented the new V6 core. However got the issues about Deleting tokens using auth-access-tokens-guard.
When testing on the postman, tokens still available on the DB, and will re-use. What i ask about it, how to correct implementation this section? In case: I Use adonis.js as a backend, and remix as a frontend-ssr |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
I just hardcode tricky using So here is my full code deleting all tokens on the Database related id from User
|
Beta Was this translation helpful? Give feedback.
-
async logout({ auth, response }: HttpContext) {
const user = auth.getUserOrFail()
const token = auth.user?.currentAccessToken.identifier
if (!token) {
return response.badRequest({ message: 'Token not found' })
}
await User.accessTokens.delete(user, token)
return response.ok({ message: 'Logged out' })
} |
Beta Was this translation helpful? Give feedback.
-
@heirro I'm many months late, but I'll add this for anyone who may find this useful.
|
Beta Was this translation helpful? Give feedback.
-
Wow! That would be my next question, thanks bro! |
Beta Was this translation helpful? Give feedback.
I just hardcode tricky using
import DB from '@adonisjs/lucid/services/db'
So here is my full code deleting all tokens on the Database related id from User