File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 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>
You can’t perform that action at this time.
0 commit comments