createToken method

  1. @override
Future<String?> createToken(
  1. String userId, {
  2. Duration validity = const Duration(days: 30),
})
override

Create a token for a user.

A token is used to authenticate the user. It is just like a password but it is destined to be used by programs instead of humans. Tokens have a limited validity period (one month).

Parameters:

  • String userId (required): The UUID that identifies the user uniquely

Implementation

@override
Future<String?> createToken(
    String userId, {
      Duration validity = const Duration(days: 30),
    }) =>
    api.baseUserApi.getToken(userId, uuid.v4(options: {'rng': UuidUtil.cryptoRNG}), tokenValidity: validity.inSeconds);