Brandawg93 / homebridge-fordpass

Control your Ford vehicle in HomeKit using Homebridge.
GNU General Public License v3.0
61 stars 15 forks source link

[Bug]: Auth failed with error: 404 #185

Closed grelca closed 2 years ago

grelca commented 2 years ago

Describe the bug

Updated from v1.5.3 to v1.6.0 last night, and the plugin is throwing a 404. Also fails when using v1.5.3. From the Homebridge log file it appears it may have been failing since May 18.

Tried with both "None" region and "US" region with the same exhibited behavior (which I realized after the fact they are not any different because they use the same application id so /shrug)

Tested the following code both locally and using https://npm.runkit.com/ (to rule out something like a local DNS issue), the POST request to https://sso.ci.ford.com/oidc/endpoint/default/token succeeds and provides a token, the PUT request to https://api.mps.ford.com/api/oauth2/v1/token fails with a 404

const querystring = require('querystring');
const axios = require('axios');

const authUrl = 'https://sso.ci.ford.com/';
const defaultAppId = '71A3AD0A-CF46-4CCF-B473-FC7FE5BC4592';
const clientId = '9fb503e0-715b-47e8-adfd-ad4b7770f73b';
const userAgent = 'FordPass/5 CFNetwork/1325.0.1 Darwin/21.1.0';

const url = authUrl + 'oidc/endpoint/default/token';
const options = {
    method: 'POST',
    url: url,
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'User-Agent': userAgent,
    },
    data: querystring.stringify({
        client_id: clientId,
        grant_type: 'password',
        username: 'grelca@gmail.com',
        password: 'redacted',
    }),
};

axios(options).then(result => {
    console.log(result.data)

    axios.put(
        'https://api.mps.ford.com/api/oauth2/v1/token',
        {
            code: result.data.access_token,
        },
        {
            headers: {
                'Content-Type': 'application/json',
                'User-Agent': userAgent,
                'Application-Id': defaultAppId,
            },
        },
    ).catch(console.log);
})

Debug Output

None, just an info log and an error log

[20/06/2022, 19:05:36] [FordPass] Initializing FordPass platform...
[20/06/2022, 19:06:07] [FordPass] Auth failed with error: 404

Steps to reproduce

  1. install/configure fordpass
  2. restart homebridge

Device Type

raspberry pi zero w, also able to repro using macbook pro

iOS Version

15.5

Bug Persistence

Consistently

Last Working Version

previously worked on v1.5.3 but doesn't now

Brandawg93 commented 2 years ago

Have you tried clearing your accessory cache and authenticating again?

grelca commented 2 years ago

Have you tried clearing your accessory cache and authenticating again?

yes. also did a brand new install on my macbook homebridge instance i use for development, where the plugin had never been installed.

masav61 commented 2 years ago

Same here

Brandawg93 commented 2 years ago

Ford broke the older api today. This should be fixed in v1.6.1.

jaxonashton commented 2 years ago

Whew! Thought this was just me, since I've been having other issues with Homebridge today.

Grabbed the update, but unfortunately, not able to re-add the bridge or device to HomeKit due to the other issues I'm having. Seems that the IPv6 tunnel I have is wrecking havoc on my HB Pi.

Brandawg93 commented 2 years ago

No worries. Let me know if you get it working so I can close this.

jaxonashton commented 2 years ago

No worries. Let me know if you get it working so I can close this.

Oh dear god don't wait on me. This is completely a PEBKAC issue and nothing to do with the plugin so far as I can tell. :)

Thanks for all you do on this plugin, mate. It's truly appreciated.

Brandawg93 commented 2 years ago

Glad you're enjoying the plugin! I usually wait to close an issue until someone else confirms it's working. I was able to reproduce the issue and fix it on my setup but just like to make sure.

jaxonashton commented 2 years ago

FWIW, I tried the features of the plugin in the HB UI, and it seems to execute without an errors.

grelca commented 2 years ago

v1.6.1 appears to be working for me (granted i haven't gone out to the car to double check locking/unlocking actually functioned as expected but the car shows up and the buttons appear to be functional)

masav61 commented 2 years ago

Updated and now it’s working again. Thank you very much!