I have a mysql table like this:
CREATE TABLE IF NOT EXISTS auth (
id BINARY(16) PRIMARY KEY);
And create a binary UUID like following within my NodeJS application:
user_id = id: <Buffer 11 ed cd 15 15 37 82 00 bf fe a5 5d 53 c7 95 d9>
Then use an insert statement to put the new user inside the table and sign a json web token as follows:
const jwt = jwt.sign(
{user_id : user_id},
process.env.JWT_KEY!,
{
expiresIn: process.env.JWT_EXPIRES_IN,
}
);
But at the front end when I try to extract user_id
from the given token using the following code:
final responseData = json.decode(response.body);
if (responseData['error'] != null) {
throw HttpException(responseData['error']['message']);
}
_token = responseData['token'];
Map<String, dynamic> decodedToken = JwtDecoder.decode(_token!);
I see something like below when I print out decodedToken
:
{type: Buffer, data: [17, 237, 205, 21, 21, 55, 130, 0, 191, 254, 165, 93, 83, 199, 149, 217]}
Why this happens and how can I fix it?