Skip to content

> error logging in: error during login: error decoding login resp: json: cannot unmarshal array into Go value of type map[string]interface {} #656

Description

@gurlivleenkainth2000

error logging in: error during login: error decoding login resp: json: cannot unmarshal array into Go value of type map[string]interface {}
Originally posted by @hrizal in #170 (comment)

Using the latest version of go-whatsapp. I am not getting qrcode on terminal with your recommened package for printing on console. Please guide me how I can get the qrcode
I've write this in main.go file and calling this function in main function. The print message in go routing is printing in the console but qrcode is not. I also used the sync package for waiting but nothing is happen.

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

	qrChan := make(chan string)
	// Goroutine is too print qrcode for session login
	go func() {
		fmt.Println("Print Qrcode on Terminal Started Execution")

		terminal := qrcodeTerminal.New()
		terminal.Get(<-qrChan).Print()
	}()

	sess, loginErr := wac.Login(qrChan)
	if loginErr != nil {
		fmt.Println("error during login: ", loginErr)
		return
	}
	fmt.Println("Login Session", sess)

}

And this is my go.mod file

module github.com/.../goWhatsappModule2022

go 1.19

require (
	github.com/Baozisoftware/qrcode-terminal-go v0.0.0-20170407111555-c0650d8dff0f
	github.com/Rhymen/go-whatsapp v0.1.1
)

require (
	github.com/golang/protobuf v1.3.0 // indirect
	github.com/gorilla/websocket v1.4.1 // indirect
	github.com/mattn/go-colorable v0.1.1 // indirect
	github.com/mattn/go-isatty v0.0.5 // indirect
	github.com/pkg/errors v0.8.1 // indirect
	github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9 // indirect
	golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 // indirect
	golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 // indirect
)

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