authenticate method

Future<DeepLinkParamSignin> authenticate(
  1. DeepLinkParamSignin deepLinkParam
)

Implementation

Future<DeepLinkParamSignin> authenticate(
    DeepLinkParamSignin deepLinkParam) async {
  final http.Response response = await http.post(
    Uri.parse(deepLinkParam.authenticationEndpoint),
    headers: <String, String>{
      'Content-Type': 'application/json; charset=UTF-8',
    },
    body: jsonEncode(<String, String>{
      'token': deepLinkParam.token,
      'signature': deepLinkParam.signature,
    }),
  );
  if (response.statusCode == 200) {
    AuthenticateResponse authenticateResponse =
        AuthenticateResponse.fromJson(json.decode(response.body));
    deepLinkParam.authenticated = authenticateResponse.data.authenticated;
    return deepLinkParam;
  } else {
    return null;
  }
}