[4.1] API listTokens(forUser) function removed


#1

Hi guys,

Since I updated from 4.1 I noticed that this code doesn’t work anymore:

await auth.authenticator('api').listTokens

Doc:
http://adonisjs.com/docs/4.1/authentication#_listtokens_2

I checked the @adonisjs/auth/src/Schemes/Api.js and noticed that listTokens as been replaced by listTokensForUser, fine. Though when I call listTokens() it doesn’t throw a “function doesn’t exist” and return [] instead, I’m wondering where this “magic” happens since the function doesn’t exist anymore (at least in this file).

Cheers,
Mathieu


#2

I don’t know is this right way but it works:

Route.get('/user', async ({auth}) => {

  const user = await auth.authenticator('api').listTokensForUser(await auth.getUser());
console.log(user);

}