Hi,

I'm experimenting with Firefox Sync login via WebChannels [0] and for
some reason I'm not receiving "fxaccounts:login" command (I am
receiving "fxaccounts:loaded" and "fxaccounts:can_link_account"
commands though).

I wish to obtain the sync tokens (sessionToken, keyFetchToken,
unwrapBKey etc.) but I cannot do that without the data sent through
the login command.

My current flow is:

1. Register a window event listener for WebChannelMessageToChrome events.

2. Load the Firefox iframe with the URL
https://accounts.firefox.com/signin?service=sync&context=fx_desktop_v2

3. Receive message with the following fields:
  * detail.id = "account_updates"
  * detail.message.command = "fxaccounts:loaded"
  * detail.message.messageId = null

4. Enter login credentials and submit them. Receive message with fields:
  * detail.id = "account_updates"
  * detail.message.command = "fxaccounts:can_link_account"
  * detail.message.messageId = UNIX timestamp in milliseconds
  * detail.message.data.email = the login email

5. Now I'm sending back a WebChannelMessageToContent message with the
same detail fields as above, except the detail.message.data.email
which is replaced with detail.message.data.ok = true.

6. Now I would expect to receive a message with command
"fxaccounts:login" as instructed [1] but this is not happening, hence
my question.

The way I send my response to the server is by creating a
window.customEvent passing the type WebChannelMessageToContent and the
detail JSON mentioned above and calling window.dispatchEvent()
afterwards.

My guess is that I'm doing something wrong when sending the
WebChannelMessageToContent response causing the server to not
acknowledge it and not send back the login message, but I'm not sure
what is it.

I would greatly appreciate some help regarding this matter.

[0] 
https://github.com/mozilla/fxa-content-server/blob/master/docs/relier-communication-protocols/fx-webchannel.md
[1] 
https://github.com/mozilla/fxa-content-server/blob/master/docs/relier-communication-protocols/fx-webchannel.md#command-order-for-a-signinsignup

Thanks,
Gabriel
_______________________________________________
Dev-fxacct mailing list
Dev-fxacct@mozilla.org
https://mail.mozilla.org/listinfo/dev-fxacct

Reply via email to