Closed Bug 1246689 Opened 8 years ago Closed 7 years ago

Expose FxA account management via accounts.firefox.com

Categories

(Firefox for iOS :: General, defect)

All
iOS
defect
Not set
normal

Tracking

()

VERIFIED FIXED
Tracking Status
fxios 9.0 ---
fxios-v9.0 --- verified
fxios-v10.0 --- verified

People

(Reporter: aaronmt, Assigned: maurya1985, Mentored)

References

Details

(Whiteboard: [good next bug][lang=swift][MobileCore][FxA] )

Attachments

(2 files)

Currently the only opportunity to manage account management is on the off-chance that you happen to tap the account name in settings on account creation (verify email address) and an onClick is available [1] to be taken to account configuration URL.

[1] https://github.com/mozilla/firefox-ios/blob/b174304c4944b55a27cadf75ffc7ffda368db683/Client/Frontend/Settings/AppSettingsOptions.swift#L177

This is the only opportunity to manage an account. We should let the user manage an account on mobile.

Please dupe if this is part of a a different meta or under a 'v2' somewhere.
Summary: Unable to access FxA account management → Expose FxA account management via accounts.firefox.com
Mentor: sleroux
Whiteboard: [good next bug][lang=swift]
To provide a little colour on this: we absolutely should allow the user to manage her Firefox Account.  We need to navigate to /settings?email=... or ?uid=... (like https://accounts.firefox.com/settings).  Then we need to handle a bunch of new messages: changed password, deleted account.  We want to handle messages for, or work with the FxA server team to hide the UI, for display name and display avatar.  (Handling avatars might require OAuth support to talk to the profile server, but we may be able to avoid that by only taking avatars from the fxa-content-server messages.)

We might move the code to use a WebChannel (see https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/WebChannel.jsm for the Gecko implementation) from the fxa-content-server, to modernize this.
Assignee: nobody → maurya1985
Status: NEW → ASSIGNED
Nick, I tried playing around by inserting the code referenced by [1] for the switch case "FxAActionNeeded.none". All actions (change password, delete account, etc.) are working. I was also able to make my gravatar the account picture. The only thing that didn't appear to be working was uploading/taking a picture manually - which I'm yet to investigate.

[1] https://github.com/mozilla/firefox-ios/blob/b174304c4944b55a27cadf75ffc7ffda368db683/Client/Frontend/Settings/AppSettingsOptions.swift#L177

However, your note in Comment 1 seemed to indicate need for additional efforts (handling messages, fxa-content-server, OAuth support, etc.) to get these things working. Since I was able to get things working without any explicit handling other than modifying the switch case, I'm curious if there's something I'm missing.
Flags: needinfo?(nalexander)
(In reply to Maurya Talisetti from comment #2)
> Nick, I tried playing around by inserting the code referenced by [1] for the
> switch case "FxAActionNeeded.none". All actions (change password, delete
> account, etc.) are working. I was also able to make my gravatar the account
> picture. The only thing that didn't appear to be working was
> uploading/taking a picture manually - which I'm yet to investigate.
> 
> [1]
> https://github.com/mozilla/firefox-ios/blob/
> b174304c4944b55a27cadf75ffc7ffda368db683/Client/Frontend/Settings/
> AppSettingsOptions.swift#L177
> 
> However, your note in Comment 1 seemed to indicate need for additional
> efforts (handling messages, fxa-content-server, OAuth support, etc.) to get
> these things working. Since I was able to get things working without any
> explicit handling other than modifying the switch case, I'm curious if
> there's something I'm missing.

All the functions in accounts.firefox.com should work (or require minor tweaks -- for example, taking photos).  However, none of what's happening will be reflected in Firefox for iOS.  For example, if you "delete your account" in the accounts.firefox.com display, Firefox for iOS *still thinks you have a valid account* and will try to connect to it and Sync it.  (I don't know if Firefox for iOS handles a remotely _deleted_ account correctly -- my guess is no, we don't.)  To really handle this, you need to make Firefox for iOS listen for the "deleted" message from the fxa-content-server, and delete the Firefox for iOS account data as well.

The code that handles that message in Firefox for Android is around https://dxr.mozilla.org/mozilla-central/rev/32dcdde1fc64fc39a9065dc4218265dbc727673f/mobile/android/modules/FxAccountsWebChannel.jsm#29 and https://dxr.mozilla.org/mozilla-central/rev/32dcdde1fc64fc39a9065dc4218265dbc727673f/mobile/android/modules/FxAccountsWebChannel.jsm#322.  (I don't know if the fxa-content-server sends the "fxaccounts:delete_account" message to iOS clients at all.  It might not.)

The code that handles messages like this in Firefox for iOS is around https://github.com/mozilla-mobile/firefox-ios/blob/b174304c4944b55a27cadf75ffc7ffda368db683/FxAClient/Frontend/SignIn/FxAContentViewController.swift#L128.

A similar thing will happen for the password changed message.

For avatars, there's Firefox for iOS code required to actually display them in the UI, and to fetch them from the avatar server.  It's the equivalent of https://bugzilla.mozilla.org/show_bug.cgi?id=fennecavatars.
Flags: needinfo?(nalexander)
Added https://github.com/mozilla/fxa-content-server/issues/4755 to track sending a "profile changed" event to Fx for iOS whenever the user updates their FxA profile.
Depends on: 1349853
Whiteboard: [good next bug][lang=swift] → [good next bug][lang=swift][MobileCore][FxA]
Comment on attachment 8897485 [details] [review]
Link to Github pull-request: https://github.com/mozilla-mobile/firefox-ios/pull/3050

Nice. LGTM.
Attachment #8897485 - Flags: review?(jhugman) → review+
Comment on attachment 8897485 [details] [review]
Link to Github pull-request: https://github.com/mozilla-mobile/firefox-ios/pull/3050

Please remove the `try!` and replace with actual try/catch or `try?`. The `try!` will crash the application if the URL is invalid. Small change of that probably, but we want to avoid crashing in all cases.
Attachment #8897485 - Flags: review-
Removed `try!` and merged to master.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Whiteboard: [good next bug][lang=swift][MobileCore][FxA] → [good next bug][lang=swift][MobileCore][FxA] [needsuplift]
Uplifted to v9.x.

Unclear if this needs to go to 8.3. May be better to just have it on the 9.0 beta so that we can see it in use a bit more?
Flags: needinfo?(vbudhram)
Yea, this was one of those I thought would be nice to get to 8.3 (if easy) but really is not a priority. It can wait for 9.x.
Flags: needinfo?(vbudhram)
Depends on: 1393746
Whiteboard: [good next bug][lang=swift][MobileCore][FxA] [needsuplift] → [good next bug][lang=swift][MobileCore][FxA]
Depends on: 1395559
Verifying as fix on master 246293a0 and beta 9.0(5725). Firefox account management page is correctly displayed.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: