{"action":"created","issue":{"url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/4086","repository_url":"https://api.github.com/repos/RocketChat/Rocket.Chat","labels_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/4086/labels{/name}","comments_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/4086/comments","events_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/4086/events","html_url":"https://github.com/RocketChat/Rocket.Chat/issues/4086","id":172572772,"number":4086,"title":"Iframe login always return status code 400","user":{"login":"viniciusrtf","id":2480680,"avatar_url":"https://avatars.githubusercontent.com/u/2480680?v=3","gravatar_id":"","url":"https://api.github.com/users/viniciusrtf","html_url":"https://github.com/viniciusrtf","followers_url":"https://api.github.com/users/viniciusrtf/followers","following_url":"https://api.github.com/users/viniciusrtf/following{/other_user}","gists_url":"https://api.github.com/users/viniciusrtf/gists{/gist_id}","starred_url":"https://api.github.com/users/viniciusrtf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viniciusrtf/subscriptions","organizations_url":"https://api.github.com/users/viniciusrtf/orgs","repos_url":"https://api.github.com/users/viniciusrtf/repos","events_url":"https://api.github.com/users/viniciusrtf/events{/privacy}","received_events_url":"https://api.github.com/users/viniciusrtf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/RocketChat/Rocket.Chat/labels/stat:%20waiting%20response","name":"stat: waiting response","color":"fbca04"},{"url":"https://api.github.com/repos/RocketChat/Rocket.Chat/labels/type:%20support","name":"type: support","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/RocketChat/Rocket.Chat/milestones/41","html_url":"https://github.com/RocketChat/Rocket.Chat/milestones/0.40.0","labels_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/milestones/41/labels","id":1984233,"number":41,"title":"0.40.0","description":"","creator":{"login":"engelgabriel","id":1000217,"avatar_url":"https://avatars.githubusercontent.com/u/1000217?v=3","gravatar_id":"","url":"https://api.github.com/users/engelgabriel","html_url":"https://github.com/engelgabriel","followers_url":"https://api.github.com/users/engelgabriel/followers","following_url":"https://api.github.com/users/engelgabriel/following{/other_user}","gists_url":"https://api.github.com/users/engelgabriel/gists{/gist_id}","starred_url":"https://api.github.com/users/engelgabriel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/engelgabriel/subscriptions","organizations_url":"https://api.github.com/users/engelgabriel/orgs","repos_url":"https://api.github.com/users/engelgabriel/repos","events_url":"https://api.github.com/users/engelgabriel/events{/privacy}","received_events_url":"https://api.github.com/users/engelgabriel/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":42,"state":"open","created_at":"2016-09-05T13:34:41Z","updated_at":"2016-09-19T21:02:23Z","due_on":"2016-09-19T00:00:00Z","closed_at":null},"comments":3,"created_at":"2016-08-22T22:45:04Z","updated_at":"2016-09-20T23:28:19Z","closed_at":null,"body":"Your Rocket.Chat version: 0.37.0 (deployed through https://rocket.chat/deploy -- I can provide installation ID if needed).\r\n\r\nI'm trying to implement Iframe login.\r\n\r\nAPI URL: https://xxx/chat/callback\r\nIframe URL: https://xxx/chat/auth\r\nMethod: POST\r\n\r\nFirst thing Rocket.chat seems to do is calling /chat/callback (API URL). In the controller of that route we're registering and logging in the user via Rocket.chat REST API, then we return the token. Example of my console.log():\r\n\r\n```\r\nObject {statusCode: 200, content: \"{\"token\":\"vXvfkvS8J-wDbNR4NMzMoNK3XKlyzP1gvoz2r5h92D2\"}\", headers: Object, data: Object}\r\n```\r\n\r\nAfter that, Rocket chat calls /chat/auth (Iframe URL). The controller of that route simply pass the token to the view. The view does the following:\r\n\r\n```\r\nwindow.parent.postMessage({\r\n      \"event\": \"login-with-token\",\r\n      \"token\": \"vXvfkvS8J-wDbNR4NMzMoNK3XKlyzP1gvoz2r5h92D2\"\r\n    }, \"*\");\r\n```\r\n\r\nThen  Rocket.chat always send the following postMessage to our view:\r\n\r\n```\r\nObject {event: \"login-error\", response: \"Unrecognized options for login request [400]\"}\r\n```\r\n\r\nWe also tried \"try-iframe-login\" and Rocket.chat hits our API URL one more time, but returns the same error.\r\n\r\nWhat am I doing wrong?\r\n\r\nThanks in advance for any insight."},"comment":{"url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/comments/248466479","html_url":"https://github.com/RocketChat/Rocket.Chat/issues/4086#issuecomment-248466479","issue_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/4086","id":248466479,"user":{"login":"viniciusrtf","id":2480680,"avatar_url":"https://avatars.githubusercontent.com/u/2480680?v=3","gravatar_id":"","url":"https://api.github.com/users/viniciusrtf","html_url":"https://github.com/viniciusrtf","followers_url":"https://api.github.com/users/viniciusrtf/followers","following_url":"https://api.github.com/users/viniciusrtf/following{/other_user}","gists_url":"https://api.github.com/users/viniciusrtf/gists{/gist_id}","starred_url":"https://api.github.com/users/viniciusrtf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viniciusrtf/subscriptions","organizations_url":"https://api.github.com/users/viniciusrtf/orgs","repos_url":"https://api.github.com/users/viniciusrtf/repos","events_url":"https://api.github.com/users/viniciusrtf/events{/privacy}","received_events_url":"https://api.github.com/users/viniciusrtf/received_events","type":"User","site_admin":false},"created_at":"2016-09-20T23:28:19Z","updated_at":"2016-09-20T23:28:19Z","body":"I'm not sure if you did ask my opinion, but here it is... Option 2 seems more flexible to me. With regard to option 1, if we force the developer to choose between two token properties, we may break something that is already in production."}}
{"actor":{"display_login":"viniciusrtf"}}