How to integrate Rocket.Chat authentication with an existing App having users in its own database

1.4k Views Asked by At

How to integrate Rocket.Chat authentication with an existing App having users in its own database. Existing Travel App has all its users in a custom users table, using email/password based authentication. We want to enable chat amongst tourists who register for tour packages on a certain day. How do we authenticate existing tourists to automatically authenticate against Rocket.Chat as well, as we want to use the REST API(s) for a seamless integration.

We don't want to use the iFrame integration as we have an existing Web built using React JS + Mobile Apps built using React Native, what would be the best approach here

2

There are 2 best solutions below

1
On
1
On

I have integrated Rocket.Chat with an existing App and this is how I have achieved it.

I did install Rocket.Chat on a new server. Keep in mind Rocket.Chat is a very resource exhausting app. Hence it is wise to install it on a separate server. You can find the hardware requirements for Rocket.Chat here

Rocket.Chat has sophisticated Rest API. I did register users on Rocket.Chat using create user API with same email id and password through which they were registered on My existing app. Now you can use create token API to get a temporary authorization token of any user registered on your Rocket.Chat instance. This temporary authorization token is called authToken. when you have got authToken all you need to do is launch URL of your installed Rocket.Chat instance with the authToken as resumeToken query parameter. An example URL is https://yourown.rocket.chat/home?resumeToken=abcd123456789

Rocket.Chat will itself do all the task of authorization user based on resumeToken query parameter and create the session for that user.