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

InternalOAuthError: Unable to fetch user profile. #54

Open
mohitgoyal707 opened this issue Jun 9, 2016 · 5 comments
Open

InternalOAuthError: Unable to fetch user profile. #54

mohitgoyal707 opened this issue Jun 9, 2016 · 5 comments

Comments

@mohitgoyal707
Copy link

mohitgoyal707 commented Jun 9, 2016

I am trying to do facebook auth login using passport-facebook-token in loopback. I followed the documentation provided but i am getting the following error message when passing auth token to my api.

500 InternalOAuthError: Failed to fetch user profile
   at /media/mohit/crytek/NodeJs/Projects/partiko-backend/node_modules/passport-facebook-token/lib/index.js:152:32
   at passBackControl (/media/mohit/crytek/NodeJs/Projects/partiko-backend/node_modules/oauth/lib/oauth2.js:123:9)
   at IncomingMessage.<anonymous> (/media/mohit/crytek/NodeJs/Projects/partiko-backend/node_modules/oauth/lib/oauth2.js:143:7)
   at emitNone (events.js:91:20)
   at IncomingMessage.emit (events.js:185:7)
   at endReadableNT (_stream_readable.js:926:12)
   at /media/mohit/crytek/NodeJs/Projects/partiko-backend/node_modules/async-listener/glue.js:188:31
   at _combinedTickCallback (internal/process/next_tick.js:74:11)
   at process._tickDomainCallback (internal/process/next_tick.js:122:9)
   at process.fallback (/media/mohit/crytek/NodeJs/Projects/partiko-backend/node_modules/async-listener/index.js:450:15)

But i got this token from facebook graph api, and is a valid token. Can anyone help me?

Also if i use access token provided on my developer account here:
https://developers.facebook.com/tools/access_token/

then i am able to fetch my own user profile. I dont understand where is the problem. I tried integrating google using passport-google-plus-token..it went well, but i am not able to integrate facebook login via access token.

@dojiboy9
Copy link

I'm seeing this issue as well! Please help.

@mohitgoyal707
Copy link
Author

Hi, I might have found the issue. Problem is not in this package, but in how facebook handles authentication. Most probably, you are using facebook credentials in testing mode. Your app is not live, so for security reasons, you can only fetch profile of users who are part of your test version of the app. In app settings @ developers.facebook.com, you will find a setting pertaining to roles, just add few of your friends there, then you can fetch there profile via the access token.

TL;DR You can fetch profiles of users by there access token only when you app is live not in testing mode. In testing mode, you can only fetch your own profile.

Please correct me, i said anything incorrect or made any false assumptions.

@Joshuabaker2
Copy link

Another thing that you can try is adding your external IP address to the server whitelist for your facebook app. This is found in the advanced section of the settings in the app developer dashboard.

@ghost
Copy link

ghost commented Feb 23, 2017

@Joshuabaker2 can you please elaborate?

i tried adding my external ip address to the app settings in Facebook Developers dashboard and i still can't run a unit test from localhost:3000

any ideas?

@Joshuabaker2
Copy link

I'm assuming you mean your server is listening to localhost:3000? That shouldn't matter as far as I know, because it is the outgoing request to Facebook that is failing, which will be via port 80 and to their IP address. If it isn't the whitelist, you might not have the Facebook account added to the list of accounts able to use the app (which you need to do until the app isn't in development mode). You'll find that somewhere in the developer settings as well (on my phone so can't check).

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

No branches or pull requests

3 participants