Go-whatsapp: error decoding login resp: json: cannot unmarshal array into Go value of type map[string]interface {}

Created on 8 Jul 2020  路  6Comments  路  Source: Rhymen/go-whatsapp

Starting with a clean session:

var resp map[string]interface{}
if err = json.Unmarshal([]byte(r), &resp); err != nil {
    return session, fmt.Errorf("error decoding login resp: %v\n", err)
}

I'm getting:

error decoding login resp: json: cannot unmarshal array into Go value of type map[string]interface {}

The JSON at this point is:

["Cmd",{"type":"update"}]

Most helpful comment

Duplicate of #376, call wac.SetClientVersion(2, 2021, 4) before login as a workaround.

All 6 comments

Duplicate of #376, call wac.SetClientVersion(2, 2021, 4) before login as a workaround.

I've noticed it seems fixed in current master without SetClientVersion- potentially tag a realase?

Duplicate of #376, call wac.SetClientVersion(2, 2021, 4) before login as a workaround.

Does not work for me. I need the master branch to fix this.

I've noticed it seems fixed in current master without SetClientVersion - potentially tag a realase?

馃槄 I'm not a maintainer (yet). I'm not sure but I think it shouldn't be necessary. If it's on master the Go CLI should be able to download and use the latest version. Try running go get -u all to upgrade your dependencies, if you started your project before the fixes you mention were pushed into master it should do the trick.

To be clear: problem apparently fixed on master, SetClientVersion not necessary and does not solve the problem.

Perhaps share some code? I'm not facing that problem, I'm using SetClientVersion _and_ always using latest version of go-whatsapp.

I'm constantly doing go get -u all, so I'm pretty sure my project uses the latest changes you're mentioning.

Perhaps share some code? I'm not facing that problem, I'm using SetClientVersion and always using latest version of go-whatsapp.

Working on master (as you have). SetClientVersion not needed. SetClientVersion on 0.1.0 without effect.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

orangehaired picture orangehaired  路  10Comments

carloslfu picture carloslfu  路  5Comments

lutpiero picture lutpiero  路  8Comments

Valdenirmezadri picture Valdenirmezadri  路  7Comments

tkovs picture tkovs  路  3Comments