Authentication using TalkLabs
Use this when you don’t run a login system and don’t want to build one. We give you the user database: you register each user with an id, a handle, and a display name, we store them, and your app puts them into chat. Your data stays yours — export it anytime.
What it takes: one call to register a user. That’s it.
Register a user
Section titled “Register a user”Give the user a stable id you choose, a handle, and a display name. We create the record (or update it if it already exists) and store it for you.
import { ChatClient } from 'sportstalk-sdk';
// Your app id + your secret API key. Keep the API key on your server.const client = ChatClient.init({ appId: APP_ID, apiToken: API_KEY });
// Create or update the user. We store them; export your data anytime.await client.createOrUpdateUser({ userid: 'u-8842', // any stable id you choose handle: 'dave_m', // unique handle displayname: 'Dave',});POST /api/v3/{appid}/user/users/{userid} — your API key in the x-api-token
header, the profile in the body.
curl -X POST \ "https://api.sportstalk247.com/api/v3/$APP_ID/user/users/u-8842" \ -H "x-api-token: $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "userid": "u-8842", "handle": "dave_m", "displayname": "Dave" }'That user now exists in your app and can be put into a room.
Put the user into a room
Section titled “Put the user into a room”To give a registered user a live chat session in the browser, mint them a token from your server — a single call — then join. That mint step is the Authentication using my identities recipe; the identity you mint is the user you just registered.
- Authentication using my identities → — mint the session for a registered user.
- Join a room → · Listen for events →
POST /user/users/{userid}in the reference →