forked from LinusU/flutter_web_auth
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to present in hidden iFrame for web (#88)
- Loading branch information
1 parent
2c4f482
commit 669cec2
Showing
4 changed files
with
98 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,26 @@ | ||
<!DOCTYPE html> | ||
<title>Authentication complete</title> | ||
<p>Authentication will complete in around two seconds. If this does not happen automatically, please | ||
close the window. | ||
<script> | ||
setTimeout(function(){ | ||
if (window.opener) { | ||
window.opener.postMessage({ | ||
<html> | ||
<head> | ||
<title>Authentication complete</title> | ||
</head> | ||
<body> | ||
<p>Authentication will complete in around two seconds. If this does not happen automatically, please close the window.</p> | ||
<script> | ||
setTimeout(function() { | ||
const message = { | ||
'flutter-web-auth-2': window.location.href | ||
}, window.location.origin); | ||
} else { | ||
localStorage.setItem('flutter-web-auth-2', window.location.href); | ||
} | ||
window.close(); | ||
}, 2000); | ||
</script> | ||
}; | ||
|
||
if (window.opener) { | ||
window.opener.postMessage(message, window.location.origin); | ||
window.close(); | ||
} else if (window.parent && window.parent !== window) { | ||
window.parent.postMessage(message, window.location.origin); | ||
} else { | ||
localStorage.setItem('flutter-web-auth-2', window.location.href); | ||
window.close(); | ||
} | ||
}, 2000); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters