Skip to content
nov matake edited this page Jun 15, 2012 · 1 revision

App Access Token

Explicit Way

Manually get an app access token.
In this way, you can store the token in DB.

app = FbGraph::Application.new(APP_ID, :secret => APP_SECRET)
app.get_access_token

Implicit Way

If you set app_secret and access to an endpoint which requires an app access token,
fb_graph automatically fetch an application token implicitly.

app = FbGraph::Application.new(APP_ID, :secret => APP_SECRET)
user = FbGraph::User.new('someone')
app.ban! user   # Get an app access token internally
app.unban! user # Cached token (in memory) is used here. No unnecessary API request.
Clone this wiki locally