Telegram login
Besides an email code, a person can sign in through Telegram. This page describes what happens inside the Fidmos window when this method is chosen: which requests go out and what errors can occur.
How sign-in goes
Section titled “How sign-in goes”-
The person confirms sign-in in Telegram. The window opens the Telegram widget; after confirmation it sends the Telegram data for verification —
POST /api/v1/embed/telegram:Content-Type: application/json { "flow_id": "...", "id": 12345678, "auth_date": 1717000000, "hash": "...", "first_name": "Jane", "username": "jane" }The server verifies the signature of the data (
hash) with the bot’s secret. If it does not match —telegram_invalid. -
The identity is linked to a user. If this Telegram is already linked to a user, the flow is ready for completion:
{ "status": "authenticated", "completion_handle": "..." }If the Telegram is not linked to anyone yet, the window gets
identity_unlinkedand creates a new user —POST /api/v1/embed/identity/createwith the sameflow_id:{ "status": "authenticated", "completion_handle": "..." } -
The window completes sign-in — it exchanges
completion_handlefor an authorization code (POST /api/v1/embed/complete) and hands it to your page viaonSuccess. Next — the usual code-for-token exchange.
Errors of this flow
Section titled “Errors of this flow”All error responses come in the envelope { "error": "<code>" }. The code meanings and the general
breakdown are in the error reference.
| Code | When |
|---|---|
telegram_invalid |
the Telegram data failed the signature check |
no_pending_identity |
there is no pending sign-in method to create a user from |
identity_taken |
this Telegram was linked to another user in the meantime |
invalid_completion |
the flow completion failed (HTTP 409) |
authorization_failed |
the window could not issue an authorization code |
flow_expired |
the flow was not found or has expired |
parent_origin_mismatch |
the request came from a foreign origin |