Improved oauth response access_token handling

This commit is contained in:
gpkvt 2022-10-23 15:57:34 +02:00
parent a3358bf9f9
commit 591909a94c
2 changed files with 4 additions and 4 deletions

BIN
tts.exe

Binary file not shown.

8
tts.py
View File

@ -1259,12 +1259,12 @@ class HTTPserv(BaseHTTPRequestHandler):
function displayCode() {\ function displayCode() {\
var url = window.location.href;\ var url = window.location.href;\
var test = url.indexOf(\"access_token\");\ var test = url.indexOf(\"access_token\");\
const queryString = window.location.search;\ var qs = new URL(window.location.href.replace(/#/g,\"?\"));\
const urlParams = new URLSearchParams(queryString);\ var token = qs.searchParams.get(\"access_token\");\
const token = urlParams.get(\"access_token\")\ var scope = qs.searchParams.get(\"scope\");\
if (test != -1) { \ if (test != -1) { \
document.getElementById(\"code\").innerHTML = \"\ document.getElementById(\"code\").innerHTML = \"\
<p>oauth:\" + token + \"</p>\ <p>Token:<br />oauth:\" + token + \"</p><p>Scope:<br />\" + scope + \"</p><p>URL:<br />\"+ url +\"</p>\
<p>Copy the token into your config.yml and restart \ <p>Copy the token into your config.yml and restart \
the bot.</p>\";}}\ the bot.</p>\";}}\
</script>\ </script>\