-
Notifications
You must be signed in to change notification settings - Fork 471
Closes #3826: FxA WebChannel WebExtension #3881
Conversation
6d30626
to
37678bc
Compare
} | ||
|
||
private fun recieveLogin(messageObj: JSONObject) { | ||
logger.info(messageObj.toString()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the result of this here is something like
{"messageId":null,"data":{"verified":false,"keyFetchToken":"7f6ef1a55cc2e629c5b587c5c1fe2a0e8e457ce594e767072e5fbe356b47bba5","sessionToken":"02c354774aa81accae09ada17b21816436dc5461250a60800d078d843c5155e2","unwrapBKey":"cbfabce2b955c06b8057f66b23073efd7fcf3790db5c2967e2291ed1740aafa8","uid":"e82283bfcc4d4e65860e4dc6ea82d378","email":"v@v.com","customizeSync":false,"verifiedCanLinkAccount":true},"command":"fxaccounts:login"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Amejia481 @grigoryk new event is now called oauth_login
and has this right now:
{"messageId":null,"data":{"action":"signup","redirect":"http://127.0.0.1:3030/oauth/success/a2270f727f45f648?code=0fdbc2e14ffa3b1d933c3d802aa4753eb6d781c38c0bd67981b6a69fa0623619&state=vHao1p6OizzwReCkQMSpZA","declinedSyncEngines":["history"],"code":"0fdbc2e14ffa3b1d933c3d802aa4753eb6d781c38c0bd67981b6a69fa0623619","offeredSyncEngines":["bookmarks","history","passwords","addons","tabs","prefs"],"state":"vHao1p6OizzwReCkQMSpZA","customizeSync":true},"command":"fxaccounts:oauth_login"}
.buildconfig.yml
Outdated
@@ -112,6 +112,10 @@ projects: | |||
path: components/feature/qr | |||
description: 'A feature that provides functionality for scanning QR codes.' | |||
publish: true | |||
feature-webchannel: | |||
path: components/feature/webchannel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename this to fxa-webchannel
"version": "1.0", | ||
"content_scripts": [ | ||
{ | ||
"matches": ["*://*/*"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lock this to FxA domains?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good idea, although that might make it harder to use custom FxA environments (stage, China, self-hosted).
Semi-related, I feel like there should also be some sort of origin check logic in here somewhere, where we verify that any messages we receive are in fact coming from the expected FxA content-server domain. Or does the webextension messaging-port magic take care of that for us?
...ture/webchannel/src/main/java/mozilla/components/feature/webchannel/WebChannelViewFeature.kt
Outdated
Show resolved
Hide resolved
sendContentMessage(status) | ||
} | ||
|
||
private fun recieveLogin(messageObj: JSONObject) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@grigoryk @Amejia481 this is where give stuff to FxA.kt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, here we are going to get notified on different states like:
accountSignedIn
accountSignedUp
passwordChange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@grigoryk could you add accountManager.finishAuthenticationAsync(code, state)
here? the data is in the messageObj
?
|
||
private fun sendLinkResponse(messageId: String) { | ||
val statusData = JSONObject() | ||
statusData.put("ok", true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we can also ask FxA.kt for stuff
@@ -59,6 +61,16 @@ class BrowserFragment : BaseBrowserFragment(), BackHandler { | |||
view = layout | |||
) | |||
|
|||
webChannelFeature.set( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@grigoryk should we work on getting an instance of FxA or FxA Manager passed in here?
...ture/webchannel/src/main/java/mozilla/components/feature/webchannel/WebChannelViewFeature.kt
Outdated
Show resolved
Hide resolved
37678bc
to
907f4f5
Compare
907f4f5
to
244fb3c
Compare
Codecov Report
@@ Coverage Diff @@
## master #3881 +/- ##
============================================
- Coverage 80.66% 80.56% -0.11%
+ Complexity 3882 3706 -176
============================================
Files 507 479 -28
Lines 17169 16687 -482
Branches 2554 2456 -98
============================================
- Hits 13850 13444 -406
+ Misses 2268 2224 -44
+ Partials 1051 1019 -32
Continue to review full report at Codecov.
|
244fb3c
to
8131628
Compare
@vladikoff what do you think about moving this into |
I would be okay with this 👍 |
1915197
to
4619eb7
Compare
9d2d596
to
787db54
Compare
This will land in #4221. |
Ref: mozilla-mobile/android-components#3881 Fixes mozilla/application-services#1594 more tests wip
Ref: mozilla-mobile/android-components#3881 Fixes mozilla/application-services#1594 more tests wip
Pull Request checklist
After merge
Requires mozilla/fxa#2043 to be deployed.
Testing
We need to open in the browser https://oauthchannel.dev.lcip.org/oauth/?action=email&response_type=code&context=oauth_webchannel_v1&client_id=a2270f727f45f648&scope=profile%2Bhttps%3A%2F%2Fidentity.mozilla.com%2Fapps%2Foldsync&state=vHao1p6OizzwReCkQMSpZA&code_challenge_method=S256&code_challenge=W9pbQWxeSWGcwHJUyJjrPQbk3ceMwP3rpCMLGkYlZfw&access_type=offline&keys_jwk=eyJjcnYiOiJQLTI1NiIsImt0eSI6IkVDIiwieCI6IktVenAyZGZSM2wwTVVIblBWMldtbzdmM0NBQlZ4cmMzTFVvb1lfeGFKNjQiLCJ5IjoiR195b0lKdk9QckhUY1lkUjlCVDBWYjdFc01nMXZHVUpEWk8wSVB2VkwyTSJ9 to receive the save
oauth_login
message.OR use the
https://oauthchannel.dev.lcip.org
env plus the r-b client ora2270f727f45f648
and addcontext=oauth_webchannel_v1
to the URL that is opened