diff options
author | 2020-10-06 14:48:49 +0100 | |
---|---|---|
committer | 2020-10-06 14:48:49 +0100 | |
commit | e06b2c25844f315954caae5ed1bc5782f4b81c86 (patch) | |
tree | e3e865836765be4f5f1b03572626e7c56c3effc2 /src/pages/CallbackPage.tsx | |
parent | Merge pull request #18 from python-discord/react/add-list-key (diff) | |
parent | Re-add the OAuth2 button to the home page (diff) |
Merge pull request #19 from python-discord/discord/add-oauth2-authorize
Add OAuth2 authorization
Diffstat (limited to 'src/pages/CallbackPage.tsx')
-rw-r--r-- | src/pages/CallbackPage.tsx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/pages/CallbackPage.tsx b/src/pages/CallbackPage.tsx new file mode 100644 index 0000000..caa384f --- /dev/null +++ b/src/pages/CallbackPage.tsx @@ -0,0 +1,17 @@ +/** @jsx jsx */ +import { jsx } from "@emotion/core"; +import { useState } from "react"; + +export default function CallbackPage() { + const [hasSent, setHasSent] = useState(false); + const params = new URLSearchParams(document.location.search); + + const code = params.get("code"); + + if (!hasSent) { + setHasSent(true); + window.opener.postMessage(code); + } + + return <p>Code is {code}</p>; +} |