How to register a user using javascript on the client

Are there JavaScript methods on rocket chat that can be used to register a user so that they don’t need to retype their details? If so, where would I find examples.

I am new to rocket chat and still finding my way around. My website uses ghost which when a user is logged in has a member object that contains name, email and UserID.

This is the use case - as a logged in visitor to website when I use the chat I don’t want to have to reenter my email and name details again so that I can save time.

Hi @mattcameron ! Welcome to our community :slight_smile:

You can do that in different ways.

Either by using an OAUTH integration or by consuming Rocket.Chat integrations REST APIs

What I have done in the past, is to store the rocketchat_user_id in your system. So whenever a user is logged in on your system, it can click on a button and trigger the integration.

So this integration will check if that user already has a rocketchat_user_id. If it has, it will create a user resume token and redirect the user to your Rocket.Chat instance with the acquired RESUME TOKEN

When it’s the first time the user logs in, you can create that user, using the same info you have at your system, generate the token, and redirect with the resume token.

The OAUTH method is more elegant, but can be a little bit more complicated to implement on your system side.

let me know if this helps :slight_smile: