Merge branch 'develop' into add-filter

This commit is contained in:
Salvatore Giordano
2021-09-30 15:32:02 +02:00
committed by GitHub
2 changed files with 10 additions and 2 deletions
@@ -46,12 +46,16 @@ class Token extends Equatable {
/// Creates a [Token] instance from the provided [rawValue] if it's valid.
factory Token.fromRawValue(String rawValue) {
final jwtBody = JsonWebToken.unverified(rawValue);
final userId = jwtBody.claims.getTyped<String>('user_id');
final userId = jwtBody.claims.getTyped('user_id');
assert(
userId != null,
'Invalid `token`, It should contain `user_id`',
);
return Token._(rawValue: rawValue, userId: userId!, authType: AuthType.jwt);
return Token._(
rawValue: rawValue,
userId: userId!.toString(),
authType: AuthType.jwt,
);
}
/// The token which can be used during the development.