Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GOT 401: AUTH_KEY_UNREGISTERED when trying the readme example #1456

Open
doaortu opened this issue Oct 16, 2024 · 0 comments
Open

GOT 401: AUTH_KEY_UNREGISTERED when trying the readme example #1456

doaortu opened this issue Oct 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@doaortu
Copy link

doaortu commented Oct 16, 2024

What version of gotd are you using?

$ go list -m github.com/gotd/td
-> github.com/gotd/td v0.111.2

Can this issue be reproduced with the latest version?

Tried in latest version v0.111.2

What did you do?

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.
}

What did you expect to see?

autheticated and code work normally

What did you see instead?

panic: callback: rpcDoRequest: rpc error code 401: AUTH_KEY_UNREGISTERED

goroutine 1 [running]:
main.main()
        /<redacted>/main.go:31 +0xc5
exit status 2

What Go version and environment are you using?

$ 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'
@doaortu doaortu added the bug Something isn't working label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant