Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect to MacPassHTTP #79

Closed
andr-04 opened this issue Mar 27, 2022 · 6 comments
Closed

Can't connect to MacPassHTTP #79

andr-04 opened this issue Mar 27, 2022 · 6 comments

Comments

@andr-04
Copy link

andr-04 commented Mar 27, 2022

Hello. I use MacPassHTTP and get the status "Something went wrong... is KeePass running and is the KeePassHttp plugin installed?"

POST http://localhost:19455/ 400 (Bad Request)

static _fetchJson(e) {
    return n(this, void 0, void 0, (function*() {
        if (a._key) {
            const t = a._generateNonce();
            (e = Object.assign({}, e, {
                Nonce: t,
                Verifier: a._encryptData(t, t),
                Id: a._id ? a._id : ""
            })).Url && (e.Url = a._encryptData(e.Url, t)),
            e.SubmitUrl && (e.SubmitUrl = a._encryptData(e.SubmitUrl, t))
        }
        const t = {
            method: "POST",
            body: JSON.stringify(e)
        }
          , r = yield s.loadSettings()
          , n = yield fetch(`http://${r.keePassHost}:${r.keePassPort}`, t);
        if (!n.ok)
            throw `HTTP error ${n.status}`;
        try {
            return yield n.json()
        } catch (e) {
            throw "Parsing response JSON failed"
        }
    }
    ))
}

Is it compatible with MacPassHTTP?

@RoelVB
Copy link
Owner

RoelVB commented Mar 31, 2022

I don't have a Mac to test this on. So this could be difficult.

Could you try the following:

  • Put your browser into developer mode (chrome://extension -> "developermode" toggle at the top)
  • Open the "backgroundpage" for ChromeKeePass
  • Try to connect CKP again
  • Check the "Network" tab of the backgroundpage
  • Hopefully the request to http://localhost:19455 shows some useful information.
  • If you want you could "Export to HAR" (last icon below the tabbar) and share it here

@RoelVB RoelVB closed this as not planned Won't fix, can't repro, duplicate, stale Jun 29, 2022
@andr-04
Copy link
Author

andr-04 commented Jul 1, 2022

Sorry for the delay.

The problem request is:

curl 'http://127.0.0.1:19455/' \
  -H 'Connection: keep-alive' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  -H 'sec-ch-ua: "Chromium";v="95", ";Not A Brand";v="99"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'Content-Type: text/plain;charset=UTF-8' \
  -H 'Accept: */*' \
  -H 'Origin: chrome-extension://dphoaaiomekdhacmfoblfblmncpnbahm' \
  -H 'Sec-Fetch-Site: none' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Accept-Language: en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7' \
  --data-raw '{"RequestType":"test-associate"}' \
  --compressed```

@andr-04
Copy link
Author

andr-04 commented Jul 1, 2022

I've investigated the problem.

In compare to other plugins, your one requests with the header Content-Type: text/plain;charset=UTF-8 instead of Content-Type: application/json.

Of course, it should be fixed, because the response are awaited in JSON format!

@RoelVB RoelVB mentioned this issue Jul 4, 2022
@RoelVB
Copy link
Owner

RoelVB commented Jul 4, 2022

Good find. I've just published 1.4.6 which will send the correct header.
Please let me know if this fixes the issue.

@RoelVB RoelVB closed this as completed Jul 4, 2022
@andr-04
Copy link
Author

andr-04 commented Jul 5, 2022

Nice! It has realy solved the problem and now it works! 👍

@RoelVB
Copy link
Owner

RoelVB commented Jul 6, 2022

Great! Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants