ssoLogin method

Future<Map<String, dynamic>> ssoLogin({
  1. required String url,
  2. required String scheme,
  3. String error = "User have canceled the process",
})

Implementation

Future<Map<String, dynamic>> ssoLogin(
    {required String url,
    required String scheme,
    String error = "User have canceled the process"}) async {
  try {
    final result = await FlutterWebAuth.authenticate(
        url: url, callbackUrlScheme: scheme, preferEphemeral: true);

    final token = Uri.parse(result).queryParameters['code'];

    return {'token': token}; // Returns the API response
  } catch (_) {
    return {"error": error};
  }
}