chore: update flutter_web_auth_2 docs to match 4.x

This commit is contained in:
Chirag Aggarwal
2025-05-22 06:03:35 +00:00
parent 6b7071ca94
commit c5f7a72409
+18 -6
View File
@@ -56,13 +56,25 @@ For web in order to capture the OAuth2 callback URL and send it to the applicati
```html
<!DOCTYPE html>
<title>Authentication complete</title>
<p>Authentication is complete. If this does not happen automatically, please
close the window.
<p>Authentication is complete. If this does not happen automatically, please close the window.</p>
<script>
window.opener.postMessage({
'flutter-web-auth-2': window.location.href
}, window.location.origin);
window.close();
function postAuthenticationMessage() {
const message = {
'flutter-web-auth-2': window.location.href
};
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();
}
}
postAuthenticationMessage();
</script>
```