Fatih
Fatih

Reputation: 235

How to verify a user is a real Facebook user

I'm using Facebook Javascript SDK from client side with a standart Facebook login button. When a user click the button I get user id from Facebook. Later I'm using Facebook PHP SDK from server side. I want to check the user id is a real user id. I searched some resources but I dont know I'm on the correct way. I using access token. My link is on the above. When I send request I get an error. Client id is my app id, client secret is secret key. Also when I send a request with curl I get an error. Which method I have to use?

HTML Code

<div class="fb-login-button" data-scope="public_profile,email,id" onlogin="checkLoginState()"></div>

My link

https://graph.facebook.com/v2.8/oauth/access_token?client_id=1798****&client_secret=efba0a******&grant_type=client_credentials

Error Code

{ "error": { "message": "The request is invalid because the app is configured as a desktop app", "type": "OAuthException", "code": 1, "fbtrace_id": "EG0HGBcdrvg" } }

The another request result is

Facebook\Http\GraphRawResponse Object ( [headers:protected] => Array ( [WWW-Authenticate] => OAuth "Facebook Platform" "invalid_request" "(#100) You must provide an app access token or a user access token that is an owner or developer of the app" [Access-Control-Allow-Origin] => * [Pragma] => no-cache [Cache-Control] => no-store [x-fb-rev] => 2873744 [Content-Type] => application/json; charset=UTF-8 [x-fb-trace-id] => HvnaZakHHGX [facebook-api-version] => v2.2 [Expires] => Sat, 01 Jan 2000 00:00:00 GMT [Vary] => Accept-Encoding [X-FB-Debug] => u2RDExwRJf06OIGbpCplHs5ZE2tQdUlWZDEFxJF0vWMcbt681uDHu/FLpewEfddPnyyBr4L/QwtxL2t+Sip9uw== [Date] => Tue, 07 Mar 2017 12:52:51 GMT [Transfer-Encoding] => chunked [Connection] => keep-alive ) [body:protected] => {"error":{"message":"(#100) You must provide an app access token or a user access token that is an owner or developer of the app","type":"OAuthException","code":100,"fbtrace_id":"HvnaZakHHGX"}} [httpResponseCode:protected] => 400 )

Upvotes: 1

Views: 1429

Answers (1)

Glen
Glen

Reputation: 104

To fix the error

The request is invalid because the app is configured as a desktop app you must re-configure your app and turn off the "Native or Desktop app" setting (see below)

enter image description here

Upvotes: 2

Related Questions