Testing Passport Facebook Strategy Oauth
Asked Answered
C

1

6

I was looking for a solid example or to be pointed in the right direction of how to simulate testing Passport-Facebook's login process. Completely clueless as where to start.

I'm open to any testing framework.

Best, Austin

Casias answered 15/5, 2015 at 17:30 Comment(2)
i had problem too, hopefully there are any person answer this question..Coleslaw
The authorization_code grant type (the one that requires the user to login on the provider's server) cannot be fully tested. If you were using Grant you can override the Facebook's authorize_url and access_url to point to a local server in your tests. These route should return fake access token, that you'll receive in the final callback of your app. No idea how is this possible to achieve with Passport though, I don't use it for OAuth login anymore :)Edition
S
1

While Passport documentation provides a crude/basic example for use Passport-Facebook strategy

http://passportjs.org/docs/facebook

You may like to have a look at this tutorial from scoth.io for detailed example, it teaches you how to authenticate via facebook, twitter and google+ using Node.js and respective strategies. You'll have to follow the first two lessons to achieve your goal

https://scotch.io/tutorials/easy-node-authentication-setup-and-local

Sholem answered 30/7, 2015 at 15:12 Comment(1)
Link is no longer active :(Motorcycle

© 2022 - 2024 — McMap. All rights reserved.