authenticateCustom method

  1. @override
Future<Session> authenticateCustom({
  1. required String id,
  2. bool create = true,
  3. String? username,
  4. Map<String, String>? vars,
})
override

Custom authentication

Nakama supports Custom Authentication methods to integrate with additional identity services.

Implementation

@override
Future<model.Session> authenticateCustom({
  required String id,
  bool create = true,
  String? username,
  Map<String, String>? vars,
}) async {
  final request = api.AuthenticateCustomRequest()
    ..create_2 = api.BoolValue(value: create)
    ..account = (api.AccountCustom()
      ..id = id
      ..vars.addAll(vars ?? {}));

  if (username != null) {
    request.username = username;
  }

  final res = await _client.authenticateCustom(request);

  return model.Session.fromDto(res);
}