I'm using opened_client for keycloak authentication and its working fine in android devices but when I run in IOS simulator it will throw error
Unhandled Exception: SocketException: Failed to create server socket (OS Error: Address already in use, errno = 48), address = 0.0.0.0, port = 8765
#0 _NativeSocket.bind (dart:io-patch/socket_patch.dart:1030:7)
<asynchronous suspension>
#1 Authenticator.authorize (package:openid_client/openid_client_io.dart:87:5)
// and the code I used
Future<bool> keyClockAuth() async {
String urlStr = domain.apiKeycloakRealm!=null
? "${domain.apiKeycloakUrl}/realms/${domain.apiKeycloakRealm}/"
: AppConstants.keycloakUrl;
Uri uri = Uri.parse(urlStr);
// create the client
var issuer = await Issuer.discover(uri);
var client = Client(issuer, clientId);
// create a function to open a browser with an url
urlLauncher(String url) async {
if (await canLaunchUrlString(url)) {
await launchUrlString(url);
} else {
throw 'Could not launch $url';
}
}
// create an authenticator
var authenticator = Authenticator(client, port: 8765,
urlLancher: urlLauncher);
// starts the authentication
var c = await authenticator.authorize();
// close the webview when finished
closeInAppWebView();
}
I'm using opened_client for keycloak authentication and its working fine in android devices but when I run in IOS simulator it will throw error
// and the code I used
Thankyou