# Twitter Authentication

**URL:** https://forum.heroiclabs.com/t/twitter-authentication/1111
**Category:** Local Setup
**Tags:** authentication
**Created:** [November 6, 2020, 11:33am UTC](https://forum.heroiclabs.com/t/twitter-authentication/1111 "2020-11-06T11:33:06Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Kc-io](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@Kc-io](https://forum.heroiclabs.com/u/Kc-io)
#### Post date: [November 6, 2020, 11:33am UTC](https://forum.heroiclabs.com/t/twitter-authentication/1111/1 "2020-11-06T11:33:06Z")

</div>

There is any way to do Twitter Authentication ?

---

<div class="post-metadata">

### Author: ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)
#### Post date: [November 6, 2020, 3:33pm UTC](https://forum.heroiclabs.com/t/twitter-authentication/1111/2 "2020-11-06T15:33:30Z")

</div>

@Kc-io You’re the first developer to request Twitter authentication support. 🙂

We could add it to the game server as an official social provider but in the meantime the best approach is to use custom authentication and use a before hook to forward the Twitter token into a REST API call that you can use to validate it and exchange the token for a Twitter user ID and pass that ID onwards to complete the authentication call.

---

<div class="post-metadata">

### Author: ![Kc-io](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@Kc-io](https://forum.heroiclabs.com/u/Kc-io)
#### Post date: [November 9, 2020, 4:51am UTC](https://forum.heroiclabs.com/t/twitter-authentication/1111/3 "2020-11-09T04:51:13Z")

</div>

Thanks.  
yes i thought about it, then i think if i  
used custom Id for twitter in future if i have to used any other Authentication then i don’t have any option left.  
Also when you add this on your official feature, how i link my previous who’s account are created and linked with custom id with you official twitter feature.

When you add a feature of Twitter in your official Authentication then i have to upgrade server version ?

---

<div class="post-metadata">

### Author: ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)
#### Post date: [November 9, 2020, 10:35am UTC](https://forum.heroiclabs.com/t/twitter-authentication/1111/4 "2020-11-09T10:35:44Z")

</div>

> used custom Id for twitter in future if i have to used any other Authentication then i don’t have any option left.

@Kc-io Yep if you use Twitter for the custom authentication slot and want to use your own custom identity provider as well in the future you’d not be able to do so.

> how i link my previous who’s account are created and linked with custom id with you official twitter feature.

You’d have to run a simple SQL query to migrate all the custom\_id column data over to a new column that is part of the feature of the game server when and if Twitter authentication becomes officially supported. For example it would look something like:

```sql
UPDATE users AS u SET twitter_id = u.custom_id, custom_id = NULL;

```

The query above assumes a new column named `"twitter_id"` exists and that we’d want to migrate field for all users. (NOTE: This query doesn’t work but demonstrates what a small “logical migration” would look like.)

> When you add a feature of Twitter in your official Authentication then i have to upgrade server version ?

Yes when (and if) we add official Twitter authentication to the list of social providers supported in the game server you’d have to update to a new release of the game server.

---

<div class="post-metadata">

### Author: ![Kc-io](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@Kc-io](https://forum.heroiclabs.com/u/Kc-io)
#### Post date: [November 9, 2020, 10:41am UTC](https://forum.heroiclabs.com/t/twitter-authentication/1111/5 "2020-11-09T10:41:18Z")

</div>

Thanks for your Detailed and satisfactory answer.

---

<div class="post-metadata">

### Author: ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)
#### Post date: [November 9, 2020, 1:47pm UTC](https://forum.heroiclabs.com/t/twitter-authentication/1111/6 "2020-11-09T13:47:30Z")

</div>

@Kc-io Please open a feature request on the server for us to add Twitter Authentication: [https://github.com/heroiclabs/nakama](https://github.com/heroiclabs/nakama)

If you can provide information like other games which use Twitter for authentication, or other details about why it would be attractive for players to use will help us with the feature prioritization.

Thanks 🙏

---

<div class="post-metadata">

### Author: ![Kc-io](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@Kc-io](https://forum.heroiclabs.com/u/Kc-io)
#### Post date: [November 10, 2020, 10:06am UTC](https://forum.heroiclabs.com/t/twitter-authentication/1111/7 "2020-11-10T10:06:03Z")

</div>

Done.

> <https://github.com/heroiclabs/nakama/issues/487>
>
> Need a twitter based Authentication, mostly Arabic clients wants to add twitter as a authentication.
> Also there is a large number of...
