- Deploy this serverless function using Vercel:
- Set Environment Variables with your Stream Video SDK's
API_KEY
andAPI_SECRET
.
![image](https://private-user-images.githubusercontent.com/7759511/278952809-aa4c3de9-6917-4323-951d-8f11ffe760d8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ0MjY3MTYsIm5iZiI6MTcyNDQyNjQxNiwicGF0aCI6Ii83NzU5NTExLzI3ODk1MjgwOS1hYTRjM2RlOS02OTE3LTQzMjMtOTUxZC04ZjExZmZlNzYwZDgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjNUMTUyMDE2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NmEzM2IxMmQ1YmE1MjNjYmRmYjc2MjRmMTJjMTE4YmY3NjliMjUzZTMwYWQ4ZmI3YWI5YmYxMzQzNTczMDkwYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.96aNhIg9MB8_nbO35mQJGY-ONeADTB8_Ml-aCeZbDvo)
This api allows for the creation of a token for the specified user. The token might be used for authentication, session management, or other purposes (as dictated by the underlying service).
It's crucial to ensure you provide the correct API key in the header and specify the appropriate user ID in the request body to successfully create a token.
-
Method
POST
-
URL
{your vercel app endpoint}
/api/create-token -
Headers
- content-type:
application/json
- api-key:
{your api key}
- content-type:
-
Body (JSON):
{ "userId": "USER_ID_TO_LOGIN" }
Replace
USER_ID_TO_LOGIN
with the appropriate user ID value.
- 200 OK: Success! Returns token details.
{ "userId": "userId", "token": "created token" }
- 400 Bad Request: Malformed request or validation errors.
- 401 Unauthorized: Invalid or missing API key.
- 500 Internal Server Error: Unexpected errors on the server side.