Skip to content

Commit da02728

Browse files
committed
flip the callback
1 parent ecaba88 commit da02728

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

oauth/app.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@
3636
const token = "%s";
3737
const data = JSON.stringify({token: token, provider: "github"});
3838
39-
// Step 1: Tell the parent we're starting auth
40-
window.opener.postMessage("authorizing:github", "*");
41-
42-
// Step 2: Wait for parent to acknowledge, then send the token
39+
// Sveltia/Decap CMS sends "authorizing:github" to the popup;
40+
// the popup replies with the token and closes itself.
4341
window.addEventListener("message", function(e) {
44-
window.opener.postMessage(
45-
"authorization:github:success:" + data,
46-
e.origin
47-
);
48-
window.close();
42+
if (e.data === "authorizing:github") {
43+
window.opener.postMessage(
44+
"authorization:github:success:" + data,
45+
e.origin
46+
);
47+
window.close();
48+
}
4949
}, false);
5050
})();
5151
</script></body></html>

0 commit comments

Comments
 (0)