Knowledgebase
Knowledgebase: TeamSpeak 3 (General)
How can I integrate large existing user bases (e.g. from a forum/website/MMO) into the TeamSpeak 3 authentication system?
This FAQ is for you if you have large community that are already authenticated (e.g. by username/password) on your game, forum or website and you would like allow these members access to a TeamSpeak 3 Server. In this FAQ we talk a lot about forum members, which might as well in your scenario be community members of something entirely different than a forum, just substitute "forum" with whatever platform your community is built on.

Use Cases
Only members: You want to create a TeamSpeak 3 server but want only forum members to be able to join (and a server password won't work for you because your community is too large to keep secrets or because you want to be able to revoke join privileges without hassle).
Special privileges: You wish to assign custom server or channel groups to your members depending on their forum rank or post count etc.

Harnessing the powers of TeamSpeak 3 allows you to create a very user friendly and simple interface to get your users onto TeamSpeak 3, but there will be some coding work to be done on the forum (developer side) to make this possible. Let's look at the two perspectives, user and developer:

Forum Users View
After logging in you will see a link "Join our TeamSpeak 3 server" which will take you to a separate page telling you to download and install the TeamSpeak 3 client (if not already present) and then to "Click this link to connect". When you click the link your TeamSpeak 3 client will start (if not already started) and then connect to the community TeamSpeak 3 server. Optionally a dialogue will ask if you wish to bookmark this server within the TS3 Client so you don't have to go through the forums "Click this link to connect" link in the future, but can just use TS3 directly to connect. If you are banned/deleted from the Forums your TeamSpeak 3 privileges will also be revoked.

Forum Developers View
For each forum user (either on demand or up front, depending on what works best in your scenario) you will create a so called privilege key (previously called "token", and still called token in the serverquery interface) which is a string that authenticates a user. Use the tokenadd serverquery command to create them, the commands might look like this:

tokenadd tokentype=0 tokenid1=7 tokenid2=0 tokendescription=automaticallyscreatedstokensfors$USER tokencustomset=ident=forum_usersvalue=$USERpident=forum_idsvalue=$USER_ID

Please refer to the tokenadd documentation for details, but take note that we are using the "tokencustomset" parameter to specify any amount of parameters that you might need to find this user in your forum user database (so to do the TS3 user <-> forum user mapping).

Once you have the token you then need to build the ts3server:// link that lies behind the "Click here to connect". It should look something like this:

<a href="ts3server://voice.teamspeak.com?nickname=$USER&addbookmark=TS-Forum-Server&token=eKnFZQ9EK7G7MhtuQB6+N2B1PNZZ6OZL3ycDp2OW/">Click here to connect</a>

The "addbookmark=xyz" is optional but recommended.

Now all you need to do is make sure privileges on TS3 are revoked/adjusted when they are changed on the forum. Say all you need is to delete TS3 accounts when you delete forum accounts. Find the code that is run when deleting a forum user, and add code that uses the serverquery interface to interface with the TS3 server, the commands could be something like this (lines beginning with ">" are sent by you, everything else is response by the server):

> customsearch ident=forum_account pattern=$USER
cldbid=123 ident=forum_account value=$USER
error id=0 msg=ok
> clientdbdelete cldbid=123
error id=0 msg=ok


Of course there are many more possibilities (e.g add a custom TS3 group for users with more than X posts on your forum etc.), your imagination is the limit :). If you wanted to make your server Members only as described above you will need to set up your permission system to facilitate this, please read the section "Invite only servers" in this thread.
(16 vote(s))
Helpful
Not helpful

Comments (0)