-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Integrate auth adapter for Facebook accountkit login #4434
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
Integrate auth adapter for Facebook accountkit login #4434
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4434 +/- ##
==========================================
- Coverage 92.89% 92.74% -0.15%
==========================================
Files 118 119 +1
Lines 8445 8479 +34
==========================================
+ Hits 7845 7864 +19
- Misses 600 615 +15
Continue to review full report at Codecov.
|
commit#1e8112 as required in Accountkit doc:
|
@6thfdwp thanks for the contribution! We're always glad to have new contributors in the community 👍 . I'm rerunning CI now as it looks like your tests are good. I'll follow up when that's done. |
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.
Looking good for an initial PR 👍 !
Couple of things that we'll need changed.
- The error messages should be unique to this auth adapter, wouldn't want to mistake them for the other facebook one.
- Code coverage diff should be as close to 100% as possible. In this case you can probably make a test which runs a faulty request through or the like.
Other than that this is looking good. Also it's getting a big close to the holidays so we might be a bit absent here and there 😄 .
} | ||
}); | ||
}).on('error', function () { | ||
reject('Failed to validate this access token with Facebook.'); |
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.
You'll want to customize this error message as it's identical to the one for facebook auth.
if (!appIds.length) { | ||
throw new Parse.Error( | ||
Parse.Error.OBJECT_NOT_FOUND, | ||
'Facebook app id is not configured.'); |
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.
Same here
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.
Facebook app id is the same for Account Kit login, so I'll probably go like 'Facebook app id for Account Kit'
} | ||
throw new Parse.Error( | ||
Parse.Error.OBJECT_NOT_FOUND, | ||
'Facebook app id is invalid for this user.'); |
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.
and here
} | ||
throw new Parse.Error( | ||
Parse.Error.OBJECT_NOT_FOUND, | ||
'Facebook auth is invalid for this user.'); |
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.
and also here
Thanks for the feedback! I'll do these tweaks. I've also actually done some local test for full request flow, all good, but this requires real access token and secret which not suitable to put in test case. But surely I can add some faulty request case with bad token etc. Have a nice holiday! 😀 |
Hi @montymxb @flovilmart, just check how to make this PR pass CI and other checks, I've done changes based on @montymxb review. I'd like to find new issues/enhancement to work on, hope that I can learn to get workflow right from the first PR for future commits. Thanks! |
Hey @6thfdwp , been a bit absent 😆 , haven't been around for like 2 weeks... I've reupped to the latest changes in master and we're pending some CI here now. Looks like the last run passed but I just want to verify that this one is good. If it succeeds I'll give this a final pre-flight inspection. Thanks for pinging us by the way! I track things mostly asynchronously using the notifications we get for the repos. Sometimes previous work can get buried while we're attempting to address what's new for a given week or day. I generally don't touch anything until I can actually respond to it, because as soon as I view anything the notification is cleared. Really wish github would allow us to reflag things for later followup or to make notifications unread. |
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.
1 typo and something that should help account for untested functionality. We won't be able to get 100% given we would need actual live appIds and a secret, which we're definitely not doing.
If you can make those couple changes that would be super 👍 .
spec/AuthenticationAdapters.spec.js
Outdated
}) | ||
}); | ||
|
||
it('should fail to validate Facebook accountkit auth with bad taken regardless of app secret proof', (done) => { |
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.
typo on taken
, should be token
if (!appIds.length) { | ||
throw new Parse.Error( | ||
Parse.Error.OBJECT_NOT_FOUND, | ||
'Facebook app id for Account Kit is not configured.'); |
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.
I would add one more test to help cover this, just omit your appIds and this should trigger.
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.
@montymxb I looked in Adapters/Auth/index.js#L50, seems in real flow, we only do validateAppId
if it's provided. So in test case I provided appIds
as empty array to simulate it's not properly configured
I would like to add that other than those couple things the code in this PR looks good to me. Once those are addressed I believe we should be ok to approve & merge. |
@montymxb no worries, totally understand when facing lots of issues and requests. I've actually used this adapter in our code base, it's been live supporting phone number login. I thought would be good to integrate and make more improvements. Thanks for review again, I will push once I update. |
…server into auth-fbaccountkit
@6thfdwp is this live or dead? |
@otymartin seems still under review, waiting to be merged |
@flovilmart anyway we can get this approved (assuming it's production ready ) 🙏🙏 |
@6thfdwp thanks for the PR, can you please update the docs alongside the PR before we merge this? Thanks! |
@flovilmart just updated docs. Please review. Thanks! |
This is looking good! Thanks! |
Thanks @6thfdwp |
Awesome, thanks @flovilmart Hope it will work, feedback welcomed @otymartin |
@6thfdwp thanks for hanging in there! Sorry I wasn't able to finish this up myself, but glad to see you got this in. |
* Integrate auth adapter for Facebook accountkit login * Also verify Facebook app id associated with account kit login * Add appsecret_proof as extra graph request parameter * Specific error message for Account kit and more test coverage * One more test to cover when AppIds for Facebook account kit not configured properly
First time PR to parse-server, try to learn and contribute back as our app also migrated to open source parse-server since last year. Hope to be part of this community to make it robust.