From 7739c9952e041102ebbcea5c2ca166a6503017dd Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sun, 27 Jan 2019 20:14:08 +0100 Subject: [PATCH] qml/pages/LoginPage.qml: Fix URL parsing to get the Authentification code --- qml/pages/LoginPage.qml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qml/pages/LoginPage.qml b/qml/pages/LoginPage.qml index be6404a..19f0948 100644 --- a/qml/pages/LoginPage.qml +++ b/qml/pages/LoginPage.qml @@ -144,7 +144,12 @@ Page { (url+"").substr(0, 38) === 'https://localhost/harbour-tooter?code=' ) { visible = false; - var authCode = (url+"").substr(-64) + + var vars = {}; + (url+"").replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value;}); /* found on https://html-online.com/articles/get-url-parameters-javascript/ */ + + var authCode = vars["code"]; + console.log(authCode) Logic.api.getAccessTokenFromAuthCode(