Fixes broken authentication due to changes in the myq cloud api (#15755)
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
This commit is contained in:
@@ -96,8 +96,8 @@ public class MyQAccountHandler extends BaseBridgeHandler implements AccessTokenR
|
|||||||
* MyQ oAuth relate fields
|
* MyQ oAuth relate fields
|
||||||
*/
|
*/
|
||||||
private static final String CLIENT_SECRET = "VUQ0RFhuS3lQV3EyNUJTdw==";
|
private static final String CLIENT_SECRET = "VUQ0RFhuS3lQV3EyNUJTdw==";
|
||||||
private static final String CLIENT_ID = "IOS_CGI_MYQ";
|
private static final String CLIENT_ID = "ANDROID_CGI_MYQ";
|
||||||
private static final String REDIRECT_URI = "com.myqops://ios";
|
private static final String REDIRECT_URI = "com.myqops://android";
|
||||||
private static final String SCOPE = "MyQ_Residential offline_access";
|
private static final String SCOPE = "MyQ_Residential offline_access";
|
||||||
/*
|
/*
|
||||||
* MyQ authentication API endpoints
|
* MyQ authentication API endpoints
|
||||||
@@ -151,7 +151,7 @@ public class MyQAccountHandler extends BaseBridgeHandler implements AccessTokenR
|
|||||||
username = config.username;
|
username = config.username;
|
||||||
password = config.password;
|
password = config.password;
|
||||||
// MyQ can get picky about blocking user agents apparently
|
// MyQ can get picky about blocking user agents apparently
|
||||||
userAgent = MyQAccountHandler.randomString(20);
|
userAgent = ""; // no agent string
|
||||||
needsLogin = true;
|
needsLogin = true;
|
||||||
updateStatus(ThingStatus.UNKNOWN);
|
updateStatus(ThingStatus.UNKNOWN);
|
||||||
restartPolls(false);
|
restartPolls(false);
|
||||||
@@ -491,6 +491,9 @@ public class MyQAccountHandler extends BaseBridgeHandler implements AccessTokenR
|
|||||||
.param("response_type", "code") //
|
.param("response_type", "code") //
|
||||||
.param("scope", SCOPE) //
|
.param("scope", SCOPE) //
|
||||||
.agent(userAgent).followRedirects(true);
|
.agent(userAgent).followRedirects(true);
|
||||||
|
request.header("Accept", "\"*/*\"");
|
||||||
|
request.header("Authorization",
|
||||||
|
"Basic " + Base64.getEncoder().encodeToString((CLIENT_ID + ":").getBytes()));
|
||||||
logger.debug("Sending {} to {}", request.getMethod(), request.getURI());
|
logger.debug("Sending {} to {}", request.getMethod(), request.getURI());
|
||||||
ContentResponse response = request.send();
|
ContentResponse response = request.send();
|
||||||
logger.debug("Login Code {} Response {}", response.getStatus(), response.getContentAsString());
|
logger.debug("Login Code {} Response {}", response.getStatus(), response.getContentAsString());
|
||||||
|
|||||||
Reference in New Issue
Block a user