Skip to main content

Stream Dev Token

When initializing the Stream Video SDK, a user token is required for authentication. This user token (or access token) contains the security credentials for a login session and uniquely identifies the user. Typically, these tokens should be generated by a secure backend server.

However, there can be scenarios, such as when creating a demonstration application with the Stream Video SDK, where setting up a backend server solely for generating user tokens may not be suitable. To accommodate such situations, the Stream Video SDK provides a convenient method for generating a developer token directly on the client side, eliminating the need for backend complications.

If you want to use devloper tokens for your project, you can follow the instructions below.

  1. Go to the Dashboard and select your application.

  2. In the Overview menu, you can find the Authentication category by scrolling to the middle of the page.

  3. Toggle on the Disable Auth Checks option and click the Submit button like the image below.

Authentication

  1. To obtain the developer token, you can simply use the StreamVideo.devToken() method, as shown in the following example:
val userId = "my_user_id"
StreamVideoBuilder(
context = context,
apiKey = BuildConfig.STREAM_API_KEY,
token = StreamVideo.devToken(userId), // here!
user = User(
id = userId,
name = "stream",
image = "http://placekitten.com/200/300",
role = "admin"
)
).build()

You can now utilize the developer token within your development environment for user authentication purposes.

note

It's important to remember that the developer token should not be used in production-level projects.

Did you find this page helpful?