100ms Logo

100ms

Docs

Search docs
/

Auth Token Endpoint Guide

Overview

100ms provides an option to get Auth Tokens without setting up a token generation backend service to simplify your integration journey while testing the sample app or building integration with 100ms.

You can find the token endpoint from the developer page in your 100ms dashboard.

Token endpoint

We recommend you move to your token generation service before you transition your app to production, as our token endpoint service will not scale in production.

The "Sample Apps" built using 100ms client SDKs require an Auth Token to join a room to initiate a video conferencing or live streaming session. Please check the Authentication and Tokens guide

Please note that you cannot use the token endpoint to create a Management Token for server APIs. Refer to the Management Token section in Authentication and Tokens guide for more information.

Get an auth token using token endpoint

You can use the token endpoint from your 100ms dashboard while building integration with 100ms. This acts as a tool enabling front-end developers to complete the integration without depending on the backend developers to set up a token generation backend service.

URL format: <YOUR_TOKEN_ENDPOINT>api/token

100ms token endpoint can generate an Auth token with the inputs passed, such as room_id, role, & user_id (optional - your internal user identifier as the peer's user_id). You can use jwt.io to validate whether the Auth token contains the same input values.

POSThttps://prod-in2.100ms.live/hmsapi/johndoe.app.100ms.live/api/token
curl --location --request POST 'https://prod-in2.100ms.live/hmsapi/johndoe.app.100ms.live/api/token' \ --header 'Content-Type: application/json' \ --data-raw '{ "room_id":"633fcdd84208780bf665346a", "role":"host", "user_id":"1234" }'
RESPONSE
Status: 200 OK
{ "token": "eyJ0eXAiOiJKV1QiLCJhbGciOi***************************R3tT-Yk", "msg": "token generated successfully", "status": 200, "success": true, "api_version": "2.0.192" }

Example client-side implementation

You can directly add this to your client-side implementation, check our sample app for reference.

Disable 100ms token endpoint

Due to some security concerns, if you don't wish to use the token endpoint to generate Auth tokens, then you can disable it on the Developers page on your dashboard by disabling the option "Disable <room_id>/<role> link format."

Disable Token endpoint

Error Response

Once you're disabled it on the dashboard, the requests to create an Auth token using the 100ms token endpoint will throw the below error:

{ "success": false, "msg": "Generating token using the room_id and role is disabled.", "api_version": "2.0.192" }

Have a suggestion? Recommend changes ->

Was this helpful?

1234