HTTP 401 · Unauthorized
HTTP 401 Authentication

When & why it happens

The session has been idle long enough that the server discarded it. Re-authenticate to start a new one.

Handling in gogram

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

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