Skip to content

README.md: Expand on Google Account pairing #152

Description

@peter-lyons-kehl

README.md mentions:

If Google only offers account pairing, you can also pair with Google account cookies copied from browser devtools:

pbpaste | ./openmessage pair --google

The CLI accepts either a JSON cookie object or a full curl command for messages.google.com/web/config

I'm not asking to be spoon-fed, but either I have no idea what I'm doing (and I admit I don't know how to get cookies from my browser, or in what format), or this doesn't work.

I've git clone openmessage (current main commit d7fc1d4). Then I've

cd openmessage
go build -o openmessage .
  1. In current Firefox, I have I got a JSON text with https://addons.mozilla.org/en-US/firefox/addon/cookie-editor (it seems maintained: https://github.com/Moustachauve/cookie-editor). I've stored it in a file, and
> cat /tmp/google_messages_cookies.txt | ./openmessage pair --google
4:42PM FTL Fatal error error="parse Google cookies: no cookies found"

My /tmp/google_messages_cookies.txt is - after replacing all values with "...", and also replacing a few "Secure-XYZ..." with "Secure-..." (if those cookie names themselves are not confidential and you need to check, I'll post them):

[
    {
        "name": "SAPISID",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "__Secure-...",
        "value": "....",
        "domain": ".google.com",
        ...
    },
    {
        "name": "AEC",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "pair_state_cookie",
        "value": "true",
        "domain": "messages.google.com",
        ...
    },
    {
        "name": "OSID",
        "value": "...",
        "domain": "messages.google.com",
    },
    {
        "name": "NID",
        "value": "...",
        "domain": ".google.com",
    },
    {
        "name": "APISID",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "__Secure-...",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "__Secure-...",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "__Secure-...",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "__Secure-...",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "__Secure-...",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "__Secure-...",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "__Secure-...",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "__Secure-BUCKET",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "__Secure-OSID",
        "value": "...",
        "domain": "messages.google.com",
        ...
    },
    {
        "name": "__Secure-STRP",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "HSID",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "S",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "SEARCH_SAMESITE",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "SID",
        "value": "...",
        "domain": ".google.com",
        ...
    },
    {
        "name": "SIDCC",
        "value": "...",
        "domain": ".google.com",
        ...

    },
    {
        "name": "SSID",
        "value": "...",
        "domain": ".google.com",
        ...
    }
]
  1. To get the cookies object in Firefox Console, I've run (not knowing if it's right - that's what Google AI suggested):
console.log(JSON.stringify(document.cookie.split('; ').reduce((acc, cookie) => { const [name, value] = cookie.split('='); acc[name] = value; return acc; }, {}), null, 2)); `

and that yielded

{
  "SID": "...",
  "APISID": "...",
  "SAPISID": "...",
  "__Secure-,,,": "same-as-next...",
  "__Secure-,,,": "same-as-previous...",
  "SIDCC": "...",
  "SEARCH_SAMESITE": "...",
  "pair_state_cookie": "true"
}

Then:

> cat /tmp/google_messages_cookies_from_ff_console.txt | ./openmessage pair --google
Starting Google account pairing...
5:01PM FTL Fatal error error="google account pairing: failed to prepare gaia pairing: HTTP 401: 16: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project."
  1. What would be a "full curl command", and to access what URL or where do I get the URL?

I'm willing to provide a PR on expanding README.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions