-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Description
Description:
I am trying to login to Iframe using the token. I generated the token at the login page using the username and password. Now on the page where I am trying to load the instance nothing is loading . I am not getting any error message on the Console.
The Rocket Chat is installed on Google Cloud Server.
The Dashboard where I want to Show Chat is on Other server
Here is the code I used to generate the token :
$data = array (
"username" => "stacy",
"password" => "password@12345"
);
$dats = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://myserverurl/api/v1/login");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $dats);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
)
);
$server_output = curl_exec ($ch);
curl_close ($ch);
$json = json_decode($server_output);
$authtok = $json->data->authToken;
Here is the Chat page where I need to show the rocket chat. Below is the JS code :
$(document).ready(function(){
var y = document.getElementById("myframe");
y.contentWindow.postMessage({
externalCommand: 'login-with-token',
token: 'fChpekpRjHrY3cGAp7D3XLxMBFSCDkzOuJVNeJJRKBR'
}, "*")
});
Here is the HTML body with the iframe and src
<iframe src="http://myserverurl/home" name="myframe" style="width:100%;" id="myframe"></iframe>Server Setup Information:
- Version of Rocket.Chat Server: 0.57.2
- Operating System: Linux
- Deployment Method(snap/docker/tar/etc): docker
- Number of Running Instances: 1
- DB Replicaset Oplog: Disabled
- Node Version: v4.8.2
Steps to Reproduce:
Expected behavior:
Should have loaded the Rocket Chat
Actual behavior:
Not loading anything on the page
Relevant logs:
Whenever I generate a token I have this Logs on server : [Method] registerLoginHandler
Log on Browser. I do not have any error