Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start FxA fixes for new templates #669

Merged
merged 7 commits into from Jan 2, 2019
Merged

start FxA fixes for new templates #669

merged 7 commits into from Jan 2, 2019

Conversation

groovecoder
Copy link
Member

@groovecoder groovecoder commented Dec 20, 2018

We still need to ...

  • Change our OAuth client to request profile scope and not just profile:email (needs FxA team to approve)
    • Store the full profile JSON in our DB
  • Include access_type=offline in our query params to get a long-life refresh token
    • Store the refresh token in our DB

@groovecoder
Copy link
Member Author

Set FXA_ENABLED=1 and this should fix the errors when being returned back to Monitor from FxA.

But, I don't see a report email in my Inbox, so there may still be a bug to work out.

@groovecoder groovecoder temporarily deployed to fx-breach-alerts December 26, 2018 16:39 Inactive
@groovecoder groovecoder force-pushed the fix-oauth-return branch 2 times, most recently from a2d5797 to 335fd33 Compare December 26, 2018 18:13
@groovecoder
Copy link
Member Author

Example of full FxA profile JSON I was able to request and store:

{"email":"lcrouch@mozilla.com","locale":"en-US,en;q=0.5","amrValues":["pwd","email"],"twoFactorAuthentication":false,"uid":"<redacted>","avatar":"https://stable.dev.lcip.org/profile/a/4672b0a97c98ed5728a8b442b5b08c5b","avatarDefault":false,"displayName":"Luke"}

To display the profile picture, we will probably have to add accounts.firefox.com to our CSP.

exports.up = function(knex, Promise) {
return knex.schema.table("subscribers", table => {
table.string("fxa_refresh_token");
table.json("fxa_profile_json");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to use table.jsonb here, as knex/knex#991 was fixed in knex/knex#1044

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to jsonb

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, Travis CI really doesn't like jsonb columns. Not the default postgres, nor specifically setting it to 9.4 or 9.6 seems to work. @jgmize - any ideas for jsonb columns on Travis?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this should work in 9.4, crowdAI/crowdai#68 (comment) needed to switch to Postgres 9.6 (and ubuntu trusty) to get jsonb working on travisci.

@groovecoder groovecoder force-pushed the fix-oauth-return branch 5 times, most recently from 04b867f to 9e0ce4c Compare December 31, 2018 21:05
@groovecoder
Copy link
Member Author

Got Travis CI fixed. @pdehaan - did you want to give this a once-over? I'm feeling pretty good about it now.

Copy link
Collaborator

@pdehaan pdehaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was on PTO and missed this... LGTM.

db/DB.js Outdated
const verifiedSubscriber = await this._verifySubscriber(emailHash);
return verifiedSubscriber[0];
const verified = await this._verifySubscriber(emailHash);
const verifiedSubscriber = verified[0];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize this is the same as the old code behavior, but should we check that verified[0] (or verifiedSubscriber) is non-null before using it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll add a check, and I'll actually add a low-level try-catch block around the subscription to basket since we may get errors beyond our control there, and we don't need/want to show those low-level errors to the user.

Copy link
Collaborator

@flodolo flodolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular issues on the l10n bits

@@ -19,6 +19,7 @@ about-firefox-alerts = About Firefox Alerts
give-feedback = Give Feedback
terms-and-privacy = Terms and Privacy

error-could-not-add-email = Could not add email to database.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

email -> email address?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@groovecoder groovecoder temporarily deployed to fx-breach-alerts January 2, 2019 17:21 Inactive
@groovecoder groovecoder merged commit c6c4c30 into master Jan 2, 2019
@groovecoder groovecoder deleted the fix-oauth-return branch January 2, 2019 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants