HTTP 401 · Unauthorized
HTTP 401 Authentication

When & why it happens

The auth key the client is using has been revoked or never existed. The session must be re-created from scratch (re-login).

Handling in gogram

Surfaced as *gogram.ErrResponseCode. Match on the message:

if err, ok := err.(*gogram.ErrResponseCode); ok { if err.Message == "AUTH_KEY_INVALID" { // handle this error } }