pomo_mondreganto
pomo_mondreganto

Reputation: 2074

Telegram login widget broken with cross site cookies disabled

Not so long ago most browsers banned third-party cookies, which broke my Telegram user authorisation flow. For example, with Prevent cross-site tracking option enabled (by default), after authorising the login in Telegram window nothing happens on my site (the request to telegram OAuth fails with NOT_AUTHORIZED reason). Turning off cross-site tracking in my browser works, but it's non-trivial for my site's visitors.

Is there any possible way to overcome with issue with Telegram login widget on newer browsers?

Upvotes: 5

Views: 2685

Answers (1)

<script async src="https://telegram.org/js/telegram-widget.js?15" 
              data-telegram-login="Anonymousairiv3Bot" 
              data-size="large" 
              data-onauth="onTelegramAuth(user)" 
              data-request-access="write">
</script>

<script type="text/javascript">
   function onTelegramAuth(user) {
      alert('Logged in as ' + user.first_name + ' ' + user.last_name + ' (' + user.id + (user.username ? ', @' + user.username : '') + ')');
   }
</script>

Upvotes: -2

Related Questions