Way to Automatically Login - Embedding Chat in existing CRM
Your Rocket.Chat version: 0.39.0
I have a very straightforward question (I think). We are creating a custom CRM for a specific industry. We would love to use RocketChat to allow the users to communicate with each other. As you can imagine we already have our own authentication scheme (user/pass). Is there a straightforward way to do 3 things:
- Embed the chat into our site (I guess we can use iframe)
- Auto-create the user account in Rocket Chat when a new user is added to the CRM
- Automatically login WITHOUT the user having to click a button or do anything else.
For example I embedded Rocket.Chat into our site using an iframe. Then I used the REST API to log the user in and got back a successful status. But the login screen still appears as if the user hasn't already been logged in. I need this to appear to be a seamless thing so that once the user logs into our CRM we can log them into Rocket.Chat.
Is this possible? If not we'll probably have to look for another solution.
Thanks.
Without seeing any code it is hard to diagnose. Are you following the guide located here? https://rocket.chat/docs/administrator-guides/authentication/iframe/
Alternatively, single sign-on (SSO), SAML or OAuth is an option. You can look in the administration settings for more information.
Yes but will either SSO or SAML allow me to bypass the login screen completely? That's the goal. I want this to be a seamless integration where the user does not even know there's a separate account for the chat.
@chodges did you find the answer? I'm trying to achieve the same thing
@sckoh What I found out is that in order to achieve full seamless integration would require me to rewrite significant parts of the code to get it work the way I wanted. I'm not willing to do that and so I ended up going with another solution. For the record I think tools like this are great but they're missing a key fact that many times chat is a component of another product not the product itself.
@chodges May I know what product are you using for chat now?
On Fri, 14 Oct 2016, 18:09 Chris Hodges, [email protected] wrote:
@sckoh https://github.com/sckoh What I found out is that in order to achieve full seamless integration would require me to rewrite significant parts of the code to get it work the way I wanted. I'm not willing to do that and so I ended up going with another solution. For the record I think tools like this are great but they're missing a key fact that many times chat is a component of another product not the product itself.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/RocketChat/Rocket.Chat/issues/4318#issuecomment-253760839, or mute the thread https://github.com/notifications/unsubscribe-auth/AF_jwMvl6gCXKNtJLBEIyv3ZSLJeUWqMks5qz1THgaJpZM4J-XOu .
@sckoh Right now I'm using CometChat. I purchased the lowest price version for $50. It does not compare to some of the features of RocketChat but the integration is flawless. That being said I'm not very happy with their customer support responsiveness but that being said the product works fairly well and it integrates. The one big upside is that CometChat have done a good job of providing numerous integration components for existing products.
+1, need this feature...
I was able to get this functionality from RocketChat's APIs/iframe integrations, though there were a few gotchas that made it tricky. But it is possible with RocketChat 0.42.0, stock.
@kginstructor did you have to edit source files? can you tell which files you edited? or you did it with just client side code?
@danielpg No source edits. All via the API stuff and creating an iframe API for the iframe integration stuff to connect to. Gotchas were correct Content-Type header on the json return and I had to send
{
"token" : "loginToken acquired via login API",
"loginToken" : "exact same token as above entry"
}
In order for the iframe to properly login. Apparently there are bugs in the javascript... sometimes it was looking for [var].token and other times it was looking for [var].loginToken, so I gave it both, both identical and obtained via the login API.
On the login API, the gotcha was expressing Content-Type as application/x-www-for-urlencoded. Those content types would probably have been done automatically with some HTML handlers, but I was using PHP's GuzzleHttp, which doesn't.
Just did those and it worked perfectly for me.
It worked for me. Thank you @kginstructor. No need "token" in my case. just "loginToken".
quick follow up ..
i do send the proper content type on the api file (also use php)
and return only the tokens .. but for some reason the script stops there.
i see in the developer console that the values have been read .. but thats it.
@kginstructor is it possible to try this same method to bypass the login screen from in an in-app browser for ios or android (using ui webview). I can get the token but no luck in bypassing the login screen using the above method.
I would assume so, @janakamarasena , they are after all browser pages. But I haven't done so myself yet.
@kginstructor I tried it and several other ways including passing using headers but no luck. If you find a proper solution please let me know. Thank You.
I've created an Rocket.Chat package for "Token Authentication". You'll be able to auth directly to the Realtime API with a hash (username + token). This hash should be created on a backend service, since the token is a secret. See here. I'm willing to open a PR to merge this, but I'm not sure if it's a proper way of authentication.
Currently searching how to implement this in the API, since I need the same feature in the RESTful API.
@Wouter0100 I will have a look at this - nice feature! I am currently also searching how to implement an additional authentication method for the api. Does anybody give me a hint?
@chrbo, I think this (https://dev.twitter.com/oauth/reference/get/oauth/authorize) is a good model. Google use this model too.
@jm4rc05 Hi - yes it will be an authentication based on a oauth access token. We currently evaluate RocketChat for an project we are using an identity server using OpenID Connect / OAuth2. Everything is working fine - RocketChat is configured to use the identity server with oauth. But we cannot login a user programatically with an oauth token. Currently we have to use the form based flow.
My question was: does anybody know how to implement an additional authentication method for the Rocket.Chat API.
Where are the currently available authentication methods configured? How can i add an additional authentication method without changing the Rocket.Chat code?
Many thanks
Could someone create a small index.php page to see the full method because i'm a bit lost. I also want to integrate rocket chat on my website with automaticall login. Thanks for your help