I’m creating a React Native app on Firebase and want to embed a chat feature inside it, for which I’m looking into Sendbird.
When a user logs into my app, I want to turn around and automatically create a user with access token in Sendbird. How can I do this without having to write backend code? According to Sendbird’s docs, [1] says that I need to use the API to create a user, but [2] says that API calls should not be made from client apps.
If I understand correctly, I will need to:
- Wait for the user to log into my app.
- Issue a Sendbird API request from a Firebase function (ie., my “backend service”) to create a user in Sendbird.
- Receive an access token back from Sendbird.
- Somehow send this access token back up to my app client where it would be saved into storage and used for subsequent requests via the Sendbird SDK.
Is there a way to avoid having to go through my app’s backend service? Any examples I can look at?
[1] https://sendbird.com/docs/chat/v3/javascript/guides/authentication
[2] https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api