$ go list -m github.com/gotd/td
-> github.com/gotd/td v0.111.2
Tried in latest version v0.111.2
I tried the very example in the README, set the appID
and appHash
, double checked the appid and apphash, both correct:
package main
import (
"context"
"fmt"
"github.com/gotd/td/telegram"
)
func main() {
appID := <redacted>
appHash := "<redacted>"
// https://core.telegram.org/api/obtaining_api_id
client := telegram.NewClient(appID, appHash, telegram.Options{})
if err := client.Run(context.Background(), func(ctx context.Context) error {
// It is only valid to use client while this function is not returned
// and ctx is not cancelled.
api := client.API()
// Now you can invoke MTProto RPC requests by calling the API.
// ...
// Return to close client connection and free up resources.
return nil
}); err != nil {
panic(err)
}
// Client is closed.
}
autheticated and code work normally
panic: callback: rpcDoRequest: rpc error code 401: AUTH_KEY_UNREGISTERED
goroutine 1 [running]:
main.main()
/<redacted>/main.go:31 +0xc5
exit status 2
$ go version
-> go version go1.22.3 linux/amd64
go env
Output
$ go env
GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/redacted/.cache/go-build' GOENV='/redacted/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMODCACHE='/redacted/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='linux' GOPATH='/redacted/go/' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/local/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64' GOVCS='' GOVERSION='go1.22.3' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='gcc' CXX='g++' CGO_ENABLED='1' GOMOD='/redacted/go.mod' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2012935186=/tmp/go-build -gno-record-gcc-switches'
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too