Debugging - nov/fb_graph GitHub Wiki

Debugging

Raw HTTP Request/Response

Call this method, then FbGraph will render raw HTTP request & response.

# FbGraph.logger = Rails.logger (optional)
FbGraph.debug!

So if you call

FbGraph::User.me('invalid_token').fetch

You’ll see something like this in your log/console.

======= [FbGraph] API REQUEST STARTED =======
GET /me?access_token=invalid_token HTTP/1.1 
Host: graph.facebook.com 


--------------------------------------------------
Status: 400 Bad Request 
Access-Control-Allow-Origin: * 
Cache-Control: no-store 
Content-Type: text/javascript; charset=UTF-8 
Expires: Sat, 01 Jan 2000 00:00:00 GMT 
Pragma: no-cache 
WWW-Authenticate: OAuth "Facebook Platform" "invalid_token" "Error validating access token: Session has expired at unix time xxxxxxx. The current unix time is xxxxxxx." 
X-FB-Rev: xxxxxxx 
X-FB-Debug: xxxxxxx
Date: Wed, 27 Jun 2012 05:06:02 GMT 
Connection: keep-alive 
Content-Length: 0 

{"error":{"message":"Error validating access token: Session has expired at unix time xxxxxxx. The current unix time is xxxxxxx.","type":"OAuthException","code":190,"error_subcode":463}}
======= [FbGraph] API REQUEST FINISHED =======

Check access token validity

## access token for an user
FbGraph::User.me(ACCESS_TOKEN).fetch
# => nothing raised?

## access token for an app
FbGraph::Application.new(:app, :access_token => ACCESS_TOKEN).fetch
# => nothing raised?

Check access token scopes (permissions)

FbGraph::User.me(ACCESS_TOKEN).permissions
⚠️ **GitHub.com Fallback** ⚠️