diff --git a/templates/main.html b/templates/main.html
index 57591b0..f7bcd4c 100644
--- a/templates/main.html
+++ b/templates/main.html
@@ -41,7 +41,8 @@
body: JSON.stringify(data)
})
.then(response => {
- window.location.replace(redirect_uri + "?code=" + response.text() + "&state=" + state)
+ let code = await response.text()
+ window.location.replace(redirect_uri + "?code=" + code + "&state=" + state)
})
.catch(error => {
alert("Error sending data: " + error.message);