decodeJwt function
Returns the decoded AuthToken based on jwt
.
Implementation
AuthToken decodeJwt(final String jwt) {
try {
return AuthToken.fromJson(jsonDecode(
utf8.decode(
base64.decode(
base64.normalize(jwt.split('.')[1]),
),
),
));
} catch (_) {
throw const FormatException('Invalid JWT.');
}
}