Add device code oauth handling
parent
7e8c2c3fcf
commit
0f73e54830
|
|
@ -57,7 +57,7 @@ Page {
|
|||
property int pairRequestId: 0
|
||||
property var pairingTransactionId: null
|
||||
property int addRequestId: 0
|
||||
property var name: ""
|
||||
property string name: ""
|
||||
property var params: []
|
||||
|
||||
function pairThing() {
|
||||
|
|
@ -558,14 +558,25 @@ Page {
|
|||
anchors.fill: parent
|
||||
url: oAuthPage.oAuthUrl
|
||||
|
||||
onUrlChanged: {
|
||||
print("OAUTH URL changed", url)
|
||||
if (url.toString().indexOf("https://127.0.0.1") == 0) {
|
||||
print("Redirect URL detected!");
|
||||
function finishProcess(url) {
|
||||
print("Confirm pairing")
|
||||
engine.thingManager.confirmPairing(d.pairingTransactionId, url)
|
||||
busyIndicator.running = true
|
||||
oAuthWebView.visible = false
|
||||
}
|
||||
|
||||
onUrlChanged: {
|
||||
print("OAUTH URL changed", url)
|
||||
if (url.toString().indexOf("https://127.0.0.1") == 0) {
|
||||
print("Redirect URL detected!")
|
||||
finishProcess(url)
|
||||
} else if (url.toString().indexOf("device-complete") >= 0) {
|
||||
// Unfortunatly device code authentication does not support redirect URLs like tado,
|
||||
// yet this hack does work for this case when the authentication has been completed.
|
||||
// The alternative would be a finished button below the webview.
|
||||
print("Device code finish URL detected!")
|
||||
finishProcess(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue