loginByOneAuth static method

Future<AuthResult> loginByOneAuth(
  1. String token,
  2. String accessToken,
  3. String extIdpConnidentifier, [
  4. LoginOptions? options,
])

login by YiDun.

Implementation

static Future<AuthResult> loginByOneAuth(
    String token, String accessToken, String extIdpConnidentifier,
    [LoginOptions? options]) async {
  Map map = {};
  map.putIfAbsent('connection', () => 'yidun');
  map.putIfAbsent('extIdpConnidentifier', () => extIdpConnidentifier);
  map.putIfAbsent(
      'yidunPayload', () => {'token': token, 'accessToken': accessToken});

  var jsonBody = jsonEncode(map);
  if (options != null) {
    jsonBody = jsonEncode(options.setValues(map));
  }
  final Result result = await post('/api/v3/signin-by-mobile', jsonBody);
  AuthResult authResult = AuthResult(result);
  authResult.user = await createUser(result);
  return authResult;
}