Pular para o conteúdo principal

Chat

Login via Código QR (QR Code) no Telegram


Login via QR code

QR code login flow.

Related TL schema:

auth.loginToken#629f1980 expires:int token:bytes = auth.LoginToken;
auth.loginTokenMigrateTo#68e9916 dc_id:int token:bytes = auth.LoginToken;
auth.loginTokenSuccess#390d5c5e authorization:auth.Authorization = auth.LoginToken;

updateLoginToken#564fe691 = Update;

authorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true password_pending:flags.2?true hash:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization;

---functions---

auth.exportLoginToken#b1b41517 api_id:int api_hash:string except_ids:Vector<int> = auth.LoginToken;
auth.acceptLoginToken#e894ad4d token:bytes = Authorization;
auth.importLoginToken#95ac5ce4 token:bytes = auth.LoginToken;

Exporting a login token

First of all, auth.exportLoginToken must be called by the app that wants to log in to an existing Telegram account.
The method will return an auth.loginToken constructor, containing a binary login token and an expiry date (usually 30 seconds).

The login token must be encoded using base64url, embedded in a tg://login?token=base64encodedtoken URL and shown in the form of a QR code to the user.
After the expiration of the current QR code, the auth.exportLoginToken method must be recalled and a new QR code must be generated automatically.

Accepting a login token

In order to log in, the QR code must be scanned and accepted by an already logged-in Telegram app using auth.acceptLoginToken.
The token must be extracted from the tg://login URI and base64url-decoded before using it in the method.

Possible errors returned by the method are:

  • 400 - AUTH_TOKEN_INVALID, an invalid authorization token was provided
  • 400 - AUTH_TOKEN_EXPIRED, the provided authorization token has expired and the updated QR-code must be re-scanned
  • 400 - AUTH_TOKEN_ALREADY_ACCEPTED, the authorization token was already used

The method will return an authorization object, containing info about the app and session that we just authorized.

Confirming (importing) the login token

After the logged-in app calls auth.acceptLoginToken and accepts the login token, the app that is trying to login will receive an updateLoginToken update, which should trigger a second call to the auth.exportLoginToken method.

This second call should then return an auth.loginTokenSuccess constructor, indicating successful login, essentially allowing further authorized interaction with the API.

If, however, there is a DC mismatch between the two apps, auth.loginTokenMigrateTo is returned instead, to which the app that is trying to login should respond by calling auth.importLoginToken with the specified token, to the specified DC.

This call should then finally return a auth.loginTokenSuccess constructor.


 

Postagens mais visitadas deste blog

Ver todas as mídias ou arquivos no Signal

Android Para ver anexos numa conversa: Abra uma conversa Toque no nome do contato para ver as  configurações de conversa . Toque  Mídia compartilhada . Escolha a  Mídia  ou  Documentos  aba. Selecione um arquivo ou deslize para ir até um. Toque  Salvar . Permite salvar fora do Signal. Para ver anexos de todas as conversas: No Signal, toque seu perfil   >  Armazenamento  >  Revisar o armazenamento Selecione  Mídia ,  Arquivos ,  Áudio , ou  Tudo . Toque e pressione num anexo. Opcional: Toque para selecionar qualquer outro anexo ou  Selecione todos . Toque    Salvar  e selecione  Sim  para salvar fora do Signal.   iOS Para ver anexos numa conversa: Abra uma conversa Toque no nome do contato para ver as  configurações de conversa . Selecione  Todas as Mídias . Selecione uma imagem, gif ou vídeo – ou deslize para ir até uma. Escolha o ícone de compartilhar ...

Bots: uma introdução para desenvolvedores

Bots: uma introdução para desenvolvedores Bots são aplicativos de terceiros executados dentro do Telegram.  Os usuários podem interagir com os bots, enviando-lhes mensagens, comandos e  solicitações inline  .  Você controla seus bots usando solicitações HTTPS para nossa  API de bot  . 1. O que posso fazer com bots? Para citar apenas algumas coisas, você pode usar bots para: Receba notificações e notícias personalizadas  .  Um bot pode atuar como um jornal inteligente, enviando conteúdo relevante assim que for publicado. Integre com outros serviços  .  Um bot pode enriquecer os bate-papos do Telegram com conteúdo de serviços externos. Gmail Bot  ,  GIF bot  ,  IMDB bot  ,  Wiki bot  ,  Music bot  ,  Youtube bot  ,  GitHubBot Aceite pagamentos de usuários do Telegram  .  Um bot pode oferecer serviços pagos ou funcionar como uma loja virtual.  Leia mais » Demo Shop B...

Como posso saber se minha mensagem foi entregue ou lida no Signal?

   Enviando Isto indica que sua mensagem está em processo de ser enviada. Se isto continuar por um longo período de tempo, certifique-se de que seu aparelho esteja conectado à Internet.    Enviado Isto indica que sua mensagem foi enviada para o serviço do Signal. Se você vê este ícone, não há problema com a conectividade no seu telefone.     Entregue  Isto indica que a mensagem foi entregue ao aparelho do destinatário.   Lido Se tanto você como seu contato tiverem  recibos de leitura ativados , isto indica que seu contato leu a mensagem.   O que posso fazer se minha mensagem do Signal não foi entregue? Você pode esperar até que seu contato tenha uma conexão à Internet e seu telefone seja capaz de recuperar as mensagens do Signal. Peça a seu contato para  solucionar problemas de notificação  no seu aparelho e garantir que as configurações de otimização da bateria não estejam interferindo na entrega de mensagens. Você v...