Fix handling of twitch auth flow rejection

master
Dessa Simpson 2020-07-05 20:13:07 -07:00
parent 12d4ffad2b
commit 19f51d3a5a
1 changed files with 4 additions and 1 deletions

View File

@ -110,7 +110,10 @@ app.post("/api/deleteRequest", async (request, response) => {
// Twitch callback // Twitch callback
app.get("/callback", async (request, response) => { app.get("/callback", async (request, response) => {
if (request.query.error) response.redirect(307, '/'); if (request.query.error) {
response.redirect(307, '/');
return;
}
var authcode = request.query.code as string; var authcode = request.query.code as string;
var tokenResponse = await fetch("https://id.twitch.tv/oauth2/token", { method: "POST", body: new URLSearchParams({ var tokenResponse = await fetch("https://id.twitch.tv/oauth2/token", { method: "POST", body: new URLSearchParams({
client_id: config.twitchClientId, client_id: config.twitchClientId,