maxgalbu / adonis5-jwt

JWT Authentication service for Adonisjs v5
MIT License
86 stars 15 forks source link

bug fix when saving token to jwt_tokens database table #5

Closed RuslanKarelin closed 2 years ago

RuslanKarelin commented 2 years ago

When calling the method generate or login, an error occurred while saving the token to the jwt_tokens table

const user = await User.find(1);
const jwt = await auth.use("jwt").generate(user);
//or using .login():
//const jwt = await auth.use("jwt").login(user);

Error

"insert into jwt_tokens (created_at, expires_at, name, refresh_token, refresh_token_expires_at, token, type, user_id) values ('2022-01-01 22:39:25', '2022-01-01 22:49:25', 'JWT Access Token', 'c351631a1e5eddc65351f4ef9e3211af4b5a48852c58dba0f3b37efed91dfaf8', 2022-01-11 22:39:25.544 +00:00, '82e0d513b1cdbca2ceee59610701fb2566b7725cab95214095a7f8e6c0622f0e', 'api', 1) - ER_WRONG_VALUE_COUNT_ON_ROW: Column count doesn't match value count at row 1"

refresh_token_expires_at must be a string value

maxgalbu commented 2 years ago

thanks! I've published 1.1.4 with this fix