[SOLVED] Seemilngly partial login within iframe integration (grayed out send window)

Description

We are trying to set-up seamless Iframe integration, inside pre-existing app. After clicking on some button, iframe should open in a modal, already logged in, and set to pre-decided channel. And - it’s almost working.

Iframe login seems okay (it talks with server, makes use of auth headers, as seen in browser console. No cors messages.).

And then - “send message” window never finishes loading. It’s always grayed out. At the same time, “receive message” area works well, it displays new messages instantenously.

I used browser tools to issue live
.postMessage({externalCommand: 'go', path: '/channel/general'}, '*');
and it worked. Channel “general” loads ok, and user can send messages there. But when going back (browser console again) to previous channel, user can’t post again.

Looks like access misconfiguration, but -

  • when I log into RocketChat instance directly (no iframe), with username/password, user sees everything as he should. Nothing is broken, channels can be posted into, everything works, user can access correct channels as their member.

Maybe someone seen something before, and could help or make suggestion?

Server Setup Information

  • Version of Rocket.Chat Server: 6.10
  • Operating System: Ubuntu 22.04 LTS
  • Deployment Method: docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version: not applicable
  • MongoDB Version: 5.0
  • Proxy: nginx
  • Firewalls involved: -

Any additional Information

Entire auth is done with “personal access tokens” with disabled 2fa.
User’s RocketChat account is created by our backend, using admin’s personal access token.
Next, user’s own personal access token is generated.
And finally, iframe is loaded with user’s own ?resumeToken=xxxx parameter

I’ll try and ask someone on the team if they know.

Also worth having a search here, and looking at related posts below.

SOLVED:

To fix the issue, I had to use channel Name, instead of channel ID as part of the initial iframe URL.
(My backend server now makes one extra call to RocketChat API, every time, to get current channel Name.)

failing example:
<iframe src="https://rocket.example.com/channel/669fbc5eb19c62f47251fb7b" ... />

what works:
<iframe src="https://rocket.example.com/channel/JohnDoeChannelName" ... />

I would imagine using ID is preferred, as they are constant, and Name could potentially be changed.
RocketChat rewrites these URL’s seamlessly, and it works correctly in normal browser window, - but within iframe, something fails.

I’m not sure if this is even a bug, and if so, it may be version-related. We’re currently on 6.10

1 Like

I’ve asked someone to look.

Generally it’s configuration so wait before opening an Issue.