Skip to content
← Back to activity

Public problem

telegram-bot-api local server returns 401 unauthorized (after logOut or wrong app_id)

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

A self-hosted telegram-bot-api server started returning 401 unauthorized on every request even though the same bot token worked against api.telegram.org, and reinstalling, changing tokens, and new app id/hash did not help. The reporter's own log review found a typo in the app_id. Separately, the maintainers confirmed a second 401 cause: after a successful logOut call, all requests to the local server return 401 for the first 10 minutes.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

Two causes for 401 on a self-hosted server: (1) a wrong appid/apphash or token (in the reporter's case a typo in app_id; it worked against the official server because that never used the local credentials), and (2) by design, every request returns 401 for the first 10 minutes after a successful logOut call. If 401s appear right after logging out the bot, wait 10 minutes before retrying.

Source: https://github.com/tdlib/telegram-bot-api/issues/80