We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ecaba88 commit da02728Copy full SHA for da02728
1 file changed
oauth/app.py
@@ -36,16 +36,16 @@
36
const token = "%s";
37
const data = JSON.stringify({token: token, provider: "github"});
38
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
+ // Sveltia/Decap CMS sends "authorizing:github" to the popup;
+ // the popup replies with the token and closes itself.
43
window.addEventListener("message", function(e) {
44
- window.opener.postMessage(
45
- "authorization:github:success:" + data,
46
- e.origin
47
- );
48
- window.close();
+ if (e.data === "authorizing:github") {
+ window.opener.postMessage(
+ "authorization:github:success:" + data,
+ e.origin
+ );
+ window.close();
+ }
49
}, false);
50
})();
51
</script></body></html>
0 commit comments