authorizeInteractive method
Future<String?>
authorizeInteractive({
- required BuildContext context,
- required String title,
- required String authorizationUrl,
- required String redirectUrl,
- required int popupWidth,
- required int popupHeight,
- bool useWebRedirectLoop = false,
override
Implementation
@override
Future<String?> authorizeInteractive({
required BuildContext context,
required String title,
required String authorizationUrl,
required String redirectUrl,
required int popupWidth,
required int popupHeight,
bool useWebRedirectLoop = false,
}) async {
if (useWebRedirectLoop) {
const AUTH_DESTINATION_KEY = "openidconnect_auth_destination_url";
html.window.sessionStorage[AUTH_DESTINATION_KEY] =
html.window.location.toString();
html.window.location.assign(authorizationUrl);
return Future<String?>.value(null);
}
final top = (html.window.outerHeight - popupHeight) / 2 +
(html.window.screen?.available.top ?? 0);
final left = (html.window.outerWidth - popupWidth) / 2 +
(html.window.screen?.available.left ?? 0);
var options =
'width=${popupWidth},height=${popupHeight},toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no&top=$top,left=$left';
final child = html.window.open(
authorizationUrl,
"open_id_connect_authentication",
options,
);
final c = new Completer<String>();
html.window.onMessage.first.then((event) {
final url = event.data.toString();
c.complete(url);
child.close();
});
return c.future;
}