Skip to content

rpc error code 401: AUTH_KEY_UNREGISTERED #976

Closed Answered by iqquee
iqquee asked this question in Q&A
Discussion options

You must be logged in to vote

I can't remember exactly what I did anymore since it has been a while now. But this is a part of the code that I'm sure solved the issue. I hope it helps.
cc @lsy88 @AndreJorgeLopes

        ctx := context.Background()
	appID, _ := strconv.Atoi(os.Getenv("TELEGRAM_APP_ID"))
	appHash := os.Getenv("TELEGRAM_APP_HASH")
	phoneNumber := os.Getenv("TELEGRAM_PHONE_NUMBER")

	client := telegram.NewClient(appID, appHash, telegram.Options{})
	if err := client.Run(ctx, func(ctx context.Context) error {
		sendCode, sendCodeErr := client.Auth().SendCode(ctx, phoneNumber, auth.SendCodeOptions{})
		if sendCodeErr != nil {
			fmt.Printf("This is the error from the send code: %v\n", sendCodeErr)
		}

		fmt.P…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@lsy88
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by iqquee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants