createToken method

  1. @override
Future<AuthSuccess> createToken(
  1. Session session, {
  2. required UuidValue authUserId,
  3. required String method,
  4. Set<Scope>? scopes,
  5. Transaction? transaction,
})
override

Creates a new authentication token for the specified user with the given authentication method and optional scopes.

When scopes is null, the token should carry the auth user's current scopes. Custom issuer implementations should follow the same contract: account-creation callbacks may change a user's scopes after creation, so on signup the token must reflect the scopes resolved at issuance time rather than scopes captured earlier.

Unlike issueToken this performs no sign-in policy check and no cookie delivery; the returned AuthSuccess always carries the secrets.

Implementation

@override
Future<AuthSuccess> createToken(
  Session session, {
  required UuidValue authUserId,
  required String method,
  Set<Scope>? scopes,
  Transaction? transaction,
}) {
  return jwt.createTokens(
    session,
    authUserId: authUserId,
    method: method,
    scopes: scopes,
    transaction: transaction,
  );
}