Merge pull request #711 from omtodkar/develop
fix(llc): support for `int` user Ids in JWT tokens
This commit is contained in:
@@ -46,12 +46,12 @@ class Token extends Equatable {
|
|||||||
/// Creates a [Token] instance from the provided [rawValue] if it's valid.
|
/// Creates a [Token] instance from the provided [rawValue] if it's valid.
|
||||||
factory Token.fromRawValue(String rawValue) {
|
factory Token.fromRawValue(String rawValue) {
|
||||||
final jwtBody = JsonWebToken.unverified(rawValue);
|
final jwtBody = JsonWebToken.unverified(rawValue);
|
||||||
final userId = jwtBody.claims.getTyped<String>('user_id');
|
final userId = jwtBody.claims.getTyped('user_id');
|
||||||
assert(
|
assert(
|
||||||
userId != null,
|
userId != null,
|
||||||
'Invalid `token`, It should contain `user_id`',
|
'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.
|
/// The token which can be used during the development.
|
||||||
|
|||||||
Reference in New Issue
Block a user