hjdhjd / homebridge-myq

:car: myQ Liftmaster and Chamberlain Plugin for Homebridge https://github.com/nfarina/homebridge
Other
567 stars 44 forks source link

Authentication issues, but it uses /api/Account/null #1068

Closed cviebrock closed 1 year ago

cviebrock commented 1 year ago

Describe The Problem: New user of Homebridge and I'm attempting to get my garage door opener added to the ecosystem. I've installed the plug-in via sudo npm install -g homebridge-myq, configured it as per below, and restarted Homebridge. I now only get the error message as shown in the logs below.

I checked other support issues, and maybe this is one of those things to be aware of, the fact that null is part of the URL it seems to be using seems suspicious to me, and maybe I've missed a step or misconfigured something.

Logs: This message repeated every ~2 minutes:

[5/4/2023, 11:29:03 AM] [myQ] myQ API: https://partner-identity.myq-cloud.com/api/Account/null Error: 400 Bad Request
[5/4/2023, 11:29:03 AM] [myQ] myQ API: Unable to complete the OAuth login redirect.

Homebridge Configuration:

{
    "bridge": {
        "name": "Homebridge DECC",
        "username": "REDACTED",
        "port": 51169,
        "pin": "REDACTED",
        "advertiser": "bonjour-hap"
    },
    "accessories": [
        {
            "accessory": "Sonos",
            "name": "Den",
            "room": "Den"
        }
    ],
    "platforms": [
        {
            "platform": "config",
            "name": "Config",
            "port": 8581
        },
        {
            "platform": "Nest",
            "googleAuth": {
                "issueToken": "REDACTED",
                "cookies": "REDACTED"
            }
        },
        {
            "platform": "myQ",
            "email": "REDACTED",
            "password": "REDACTED"
        }
    ]
}

Not sure if relevant, but the myQ email uses plus addressing: i.e. it's something like bob+myq@example.com.

Environment:

cviebrock commented 1 year ago

As a follow-up, I tried adding

"myQRegion": "west",

to my config. When I do, Homebridge doesn't restart properly:

...
[5/4/2023, 11:50:17 AM] TypeError: Cannot read properties of undefined (reading 'length')
    at myQApi.oauthLogin (file:///opt/local/lib/node_modules/homebridge-myq/node_modules/@hjdhjd/myq/src/myq-api.ts:190:44)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at myQApi.getOAuthToken (file:///opt/local/lib/node_modules/homebridge-myq/node_modules/@hjdhjd/myq/src/myq-api.ts:239:16)
    at myQApi.acquireAccessToken (file:///opt/local/lib/node_modules/homebridge-myq/node_modules/@hjdhjd/myq/src/myq-api.ts:367:19)
    at myQApi.refreshAccessToken (file:///opt/local/lib/node_modules/homebridge-myq/node_modules/@hjdhjd/myq/src/myq-api.ts:413:14)
    at myQApi.refreshDevices (file:///opt/local/lib/node_modules/homebridge-myq/node_modules/@hjdhjd/myq/src/myq-api.ts:455:10)
    at myQPlatform.updateAccessories (file:///opt/local/lib/node_modules/homebridge-myq/src/myq-platform.ts:295:10)
    at file:///opt/local/lib/node_modules/homebridge-myq/src/myq-platform.ts:337:14
[5/4/2023, 11:50:17 AM] Got SIGTERM, shutting down Homebridge...

Setting the region to east just returns the original error messages in my original comment.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

cviebrock commented 1 year ago

Pinging to keep from going stale.

hjdhjd commented 1 year ago

Thanks for the report.

Using myQRegion is hit or miss...and generally I wouldn't recommend using it. It's for certain edge cases only. Using anything other than the defaults and you're on your own. myQ has it's own ideas and geo-locking that they choose to enforce, we've got little visibility into it. That said, it should definitely behave more gracefully - I appreciate you highlighting the error, and I'll address it in a future release.

That said, I can't replicate your error...I've seen issues with people's local DNS setups in the past, particularly if you're using network-level ad blockers as some components of the myQ authentication sequence can get filtered out by things like pihole.

Do you have anything along those lines by chance? Otherwise, the API can flake out at times, as mentioned in the docs. I know unsatisfying...but we're dealing with a black box to some degree. 😄

cviebrock commented 1 year ago

Thanks for the response. I tried manually setting the region, and also just letting myQ decide ... and based on the response, I think it's picking east. But yeah, I get that setting it manually could be dicey, so I have that turned off now.

I don't run any ad blockers or do anything else "weird" with network traffic in my home network. My router is advertising itself as the DNS server, and then forwarding requests to 1.1.1.1, 9.9.9.9, or 8.8.8.8.

If there's anything else I can do to test my setup, or provide anymore debugging info, let me know and I'll be happy to help. My garage was broken into last night ... and part of the reason I'm setting up Homebridge is so that I can set up some automations based on when the garage door opens! 😆 😭

cviebrock commented 1 year ago

Ok, I think this was entirely my fault. I tried logging out and back in via the mobile myQ app, and it alerted me saying there were too many attempts, and I should reset my password or try again in an hour.

I think I had the wrong password setup in Homebridge. 🤦

Reset the password, and logged in via the app successfully. Copied the new password over to Homebridge config, and it logs in fine now.

Sorry to raise the issue. Maybe the logging could be more verbose in Homebridge in these cases (if the API returns a response that makes it possible to determine things like too many attempts, or whatever)? But feel free to close this after you've read about my idiocy. 😉

hjdhjd commented 1 year ago

Glad you got it working!

github-actions[bot] commented 1 year ago

This issue is locked to prevent necroposting on closed issues. Please create a new issue for related support requests, bug reports, or feature suggestions.