Closed Bug 1229023 Opened 9 years ago Closed 9 years ago

Fetch and expose Firefox Accounts profile data

Categories

(Firefox OS Graveyard :: FxA, defect, P3)

ARM
Gonk (Firefox OS)
defect

Tracking

(firefox45 fixed)

RESOLVED FIXED
2.6 S2 - 12/4
Tracking Status
firefox45 --- fixed

People

(Reporter: ferjm, Assigned: ferjm)

References

Details

Attachments

(1 file)

We need to expose information like the FxA user name and avatar in B2G.
Assignee: nobody → ferjmoreno
Priority: -- → P3
Target Milestone: --- → 2.6 S2 - 12/4
Attached patch v1Splinter Review
Attachment #8694252 - Flags: review?(markh)
Adding some FxA team folks just for situational awareness; cool to see this moving forward!
Comment on attachment 8694252 [details] [diff] [review]
v1

Review of attachment 8694252 [details] [diff] [review]:
-----------------------------------------------------------------

It's a bit of a shame about the duplication in FxAccountsManager.jsm, but that already existed. It looks fine to me.

::: services/fxaccounts/FxAccountsManager.jsm
@@ +62,5 @@
>  
>      return {
>        email: this._activeSession.email,
> +      verified: this._activeSession.verified,
> +      profile: this._activeSession.profile

I'd suggest a trailing "," here so the next change doesn't need to touch this line.

@@ +432,5 @@
>          if (!user.verified) {
>            this.verificationStatus(user);
> +          // Trying to get the profile for unverified users will fail, so we
> +          // don't even try in that case.
> +          log.debug("Account " + JSON.stringify(this._user));

You can write this as |log.debug("Account", this._user);| and Log.jsm will stringify it for you (and ditto below)

@@ +443,5 @@
> +          }
> +          log.debug("Account " + JSON.stringify(this._user));
> +          return Promise.resolve(this._user);
> +        }).catch(error => {
> +          log.debug("Account " + JSON.stringify(this._user));

Shouldn't we log error? And I think you can just return |this._user| without wrapping it in a promise.

@@ +512,5 @@
> +          this._fxAccounts.getSignedInUserProfile().then(profile => {
> +            if (profile) {
> +              this._activeSession.profile = profile;
> +            }
> +          });

we probably need a trailing .catch which logs here as the promise isn't returned - a rejection would result in one of those "an unhandled rejection" messages.
Attachment #8694252 - Flags: review?(markh) → review+
https://hg.mozilla.org/mozilla-central/rev/b7dd3ffbf52b
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: