Improvement: Simpler iFrame integration solution/Seamless login without SSO
Description:
There have been several issues raised by people who would like to integrate Rocket.Chat into their sites as an iFrame, but are having huge difficulties around implementing seamless login due to the complexities of the supported SSO methods.
I have also been having problems trying to integrate Rocket.Chat with our site. We’d like to use our current users, and seamlessly log in to Rocket Chat via an iframe (automatically creating users where they have not yet been created). I had some success (eventually) using CAS, but it adds a lot more complexity to our architecture (something I am really keen to avoid at the moment), and ran into many small issues with OAUTH and SAML.
I would therefore like to propose a simpler, bespoke integration solution for the iframe use case:
-
The user’s website generates (and stores) a unique, one-time use, token, which is passed in to Rocket.Chat as a parameter in the URL when loading the page. (e.g. <iframe src="https://chat.mysite.com?userToken=GDGGE4344t43”>
-
Rocket.Chat receives this request, takes the userToken parameter, and then calls a server-to-server API to validate this token
e.g.
POST /validateUserToken
{ userToken: “GDGGE4344t43”, clientId: “RocketChat” secret: “myPassword” }
- If the key is valid and associated with a user, the API then responds with the user’s details:
e.g.
{ fullName: “Bobby Blue”, username: “bob”, rooms: [“defaultRoom”, “bobsRoom”] }
- Rocket.Chat takes this response, and creates the user if they don’t yet exist, and logs them in. Rocket.Chat will also update the full name and the rooms of the user if they already exist.
Server Setup Information:
- Version of Rocket.Chat Server: 0.58.2
- Operating System: Ubuntu Linux
- Deployment Method(snap/docker/tar/etc): tar
- Number of Running Instances: 1
- DB Replicaset Oplog:
- Node Version: v4.2.4
Steps to Reproduce:
Please see description
Expected behavior:
Simplified login process to work as expected
Actual behavior:
Simplified login process not yet supported
So this hasn't been resolved yet right? how complicated is CAS? i am trying that.
@jy2008 it's possible, but it is a bit tricky. CAS is a large project, which isn't particularly well documented. I get the impression that this is intentional and that they make a lot of money through consultancy services.
Another problem with CAS is that the Rocket Chat integration seems to have an issue with seamless login: (https://github.com/RocketChat/Rocket.Chat/issues/8050), so the user would still be forced to click the login button :-(.
It might be worth checking out how Muut does this: Muut Federated Id
You pass an encrypted message that identifies you as an admin and the email and name of the logged in user. On the server side, Muut creates the user if needed and connects them to the iframe session. Very easy to set up.
Any update on this? Any easier ways to integrate? :)
We have improved our documentations page for iframe integration: https://rocket.chat/docs/developer-guides/iframe-integration/#iframe-integration
Please let us know if you are still facing difficulties. Thanks.