Rocket Chat Iframe Throwing Errors While Loading


We have integrated rocket chat into our application using Iframe integration. We are doing Iframe auth in following ways.

  • We are logging in user into rocket chat and getting back auth token which are posting to iframe using window.parent.postMessage(
    event: ‘login-with-token’,
  • We also added our application login API endpoint in the Iframe’s API url section.

The iframe is loading and is functional but during initial loading, it is throwing errors like “channel doesn’t exist” and ‘user doesn’t exist’. The loading is taking longer than usual. We could see that the API url we exposed for Iframe auth is throwing 403 forbidden error though in our API, that endpoint is made to ignore csrf.

We removed API authentication and tried only with rocket chat API method (as given in documentation) by posting loginToken to Iframe using window.postMessage. That doesn’t seem to be working at all when API URL is removed from Iframe configuration.

I am looking for help in getting the iframe integration done properly and provide a seamless chat experience to the users.

Server Setup Information

  • Version of Rocket.Chat Server: 3.4.1
  • Operating System: Linux
  • Deployment Method: Docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version: v12.16.1
  • MongoDB Version: 4.0.19