sendToBackend method

Future<void> sendToBackend(
  1. String accessToken,
  2. String ssoClient
)

Implementation

Future<void> sendToBackend(String accessToken, String ssoClient) async {
  print('Function Send To Backend');
  print('Function Send To Backend accessToken: $accessToken');
  print('Function Send To Backend ssoClient: $ssoClient');
  try {
    final model =
        AzureTokenInputModel(accessToken: accessToken, appidpid: appidpid_shared_preferences??0, idpid: idpid_shared_preferences??0, deviceToken: 'abc123toke21n2');
    final response = await _dio.post(
      'http://192.168.0.87:3333/auth',
      data: model.toJson(),
    );

    if (response.statusCode == 200) {
      print('JWT from backend: ${response.data}');
    } else {
      print('Backend error: ${response.statusCode} ${response.data}');
    }
  } catch (e) {
    print('Error sending tokens to backend: $e');
    if (e is DioError) {
      print('Request data: ${e.requestOptions.data}');
      print('Response data: ${e.response?.data}');
    }
  }
}