Question

All I can get is a Anonymous user token through the dev test users area on Facebook. So when I fire a POST to auth with my web application using the said token I get:

"error parsing": "Facebook.FacebookOAuthException: (OAuthException - #100) (#100) Tried accessing unexisting field (friends) on node type (AnonymousUser

Do I have to generate the token in code with the permissions request set, or is there a quicker way?

Was it helpful?

Solution

Have you creeated your test users via the endpoint

POST /{app-id}/accounts/test-users

as described in https://developers.facebook.com/docs/graph-api/reference/app/accounts/test-users#publish

I guess you have to manually "friend" two test users first, as describes here: https://developers.facebook.com/docs/graph-api/reference/test-user/friends I don't think that if you create a new test user, he'll automatically have some friends.

OTHER TIPS

I assume you have registered an app at Facebook and you have your application client_id and client_secret. Here are the steps to obtain an access token @ Facebook and how you can use it:

  1. https://graph.facebook.com/oauth/authorize?redirect_uri={your_redirect_uri}&client_id={your_client_id} If you are not logged in Facebook, you will be redirected to Login page at FB. Upon successful login, you will be redirected to your redirect_uri(in the first request) and a query param code in the URI Copy that code(auth_code) - it will be used to obtain an access token.

  2. https://graph.facebook.com/oauth/access_token?redirect_uri={your_redirect_uri}&client_id={your_client_id}&client_secret={your_client_secret}&code={auth_code} as a response you will receive an access token

Then you can use that access token to obtain your FB profile, for instance: GET https://graph.facebook.com/me plus Authorization: Bearer {access_token}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top