Force https for oauth
This commit is contained in:
parent
831fc98ab1
commit
9303e4c0a5
@ -14,7 +14,7 @@ class AuthManager {
|
||||
Completer completer = Completer();
|
||||
final flutterWebviewPlugin = new FlutterWebviewPlugin();
|
||||
flutterWebviewPlugin.onUrlChanged.listen((String url) {
|
||||
if (url.startsWith("http://ha-client.estevez.dev/service/auth_callback.html")) {
|
||||
if (url.startsWith("https://ha-client.estevez.dev/service/auth_callback.html")) {
|
||||
Logger.d("url=$url");
|
||||
String authCode = url.split("=")[1];
|
||||
Logger.d("authCode=$authCode");
|
||||
@ -23,7 +23,7 @@ class AuthManager {
|
||||
endPoint: "/auth/token",
|
||||
contentType: "application/x-www-form-urlencoded",
|
||||
includeAuthHeader: false,
|
||||
data: "grant_type=authorization_code&code=$authCode&client_id=${Uri.encodeComponent('http://ha-client.estevez.dev')}"
|
||||
data: "grant_type=authorization_code&code=$authCode&client_id=${Uri.encodeComponent('https://ha-client.estevez.dev')}"
|
||||
).then((response) {
|
||||
Logger.d("Got temp token");
|
||||
String tempToken = json.decode(response)['access_token'];
|
||||
|
@ -59,9 +59,9 @@ class ConnectionManager {
|
||||
_token = await storage.read(key: "hacl_llt");
|
||||
Logger.e("Long-lived token read successful");
|
||||
oauthUrl = "$httpWebHost/auth/authorize?client_id=${Uri.encodeComponent(
|
||||
'http://ha-client.estevez.dev')}&redirect_uri=${Uri
|
||||
'https://ha-client.estevez.dev')}&redirect_uri=${Uri
|
||||
.encodeComponent(
|
||||
'http://ha-client.estevez.dev/service/auth_callback.html')}";
|
||||
'https://ha-client.estevez.dev/service/auth_callback.html')}";
|
||||
settingsLoaded = true;
|
||||
} catch (e) {
|
||||
completer.completeError(HAError("Error reading login details", actions: [HAErrorAction.tryAgain(type: HAErrorActionType.FULL_RELOAD), HAErrorAction.loginAgain()]));
|
||||
|
Reference in New Issue
Block a user