Go-whatsapp: Login error + Qr Code does not appear

Created on 27 May 2020  ·  2Comments  ·  Source: Rhymen/go-whatsapp

I have just downloaded and installed the last version of the API, however I'm getting the following error when trying to login:

error during login: error decoding login resp: json: cannot unmarshal array into Go value of type map[string]interface {}
login successful, session: {1dsbz/ii4/gklNF+Xru+wQ== [] [] }

I know there are a few issues related to this but I couldn't find any solution. It was supposed to display the Qr Code, right?

The code I'm using

package main 

import (
    "fmt"
    "github.com/Baozisoftware/qrcode-terminal-go"
    "github.com/Rhymen/go-whatsapp"
    "os"
    "time"
)

func main() {
    wac, err := whatsapp.NewConn(5 * time.Second)
    if err != nil {
        panic(err)
    }

    qr := make(chan string)
    go func() {
        terminal := qrcodeTerminal.New()
        terminal.Get(<-qr).Print()
    }()

    session, err := wac.Login(qr)
    if err != nil {
        fmt.Fprintf(os.Stderr, "error during login: %v\n", err)
    }
    fmt.Printf("login successful, session: %v\n", session)
}

Am I doing something wrong? Thank you for your reply.

Most helpful comment

Try setting the ClientVersion manually. wac.SetClientVersion(2, 2021, 4) worked for me.
0.1.0 version use an old one.

All 2 comments

Try setting the ClientVersion manually. wac.SetClientVersion(2, 2021, 4) worked for me.
0.1.0 version use an old one.

Try setting the ClientVersion manually. wac.SetClientVersion(2, 2021, 4) worked for me.
0.1.0 version use an old one.

Thank you very much! It indeed worked but now I have another issue:
I'm getting a new error when trying to restore the session:

restoring failed: admin login responded with 403
I have heard it has something to do with the token. How do I set the token?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Leonardo-Crespo picture Leonardo-Crespo  ·  6Comments

lutpiero picture lutpiero  ·  8Comments

Valdenirmezadri picture Valdenirmezadri  ·  5Comments

it-sumanp picture it-sumanp  ·  8Comments

sbruder picture sbruder  ·  9Comments