import 'dart:io'; import 'package:openid_client/openid_client.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:openid_client/openid_client_io.dart' as io; Future authenticate(Client client, {List scopes = const []}) async { // create a function to open a browser with an url urlLauncher(String url) async { var uri = Uri.parse(url); if (await canLaunchUrl(uri) || Platform.isAndroid) { await launchUrl(uri); } else { throw 'Could not launch $url'; } } // create an authenticator var authenticator = io.Authenticator(client, scopes: scopes, port: 3000, urlLancher: urlLauncher, redirectMessage: 'Logged In..' ); var c = await authenticator.authorize(); // close the webview when finished if (Platform.isAndroid || Platform.isIOS) { closeInAppWebView(); } return c; } Future getRedirectResult(Client client, {List scopes = const []}) async { return null; }