diff --git a/README.md b/README.md index b78d62a..50ad885 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,24 @@ After you are done, run this in your shell to fetch the new dependency: $ mix deps.get ``` +## Configuration + +You can configure facebook.ex in your mix `config.exs` (or, if you're using the Phoenix Framework, in your `dev/test/prod.exs`, respectively) with the following keys, which state the library defaults: +``` +config :facebook, + appsecret: nil, + graph_url: "https://graph.facebook.com", +  graph_video_url: "https://graph-video.facebook.com" +``` +For graph_url and video_graph_url, Facebook automatically uses the oldest active Graph API version available if you don't specify a version in the url. You may use versioned urls to pin your calls to a specific API versions (recommended), e.g. like so: +``` + graph_url: "https://graph.facebook.com/v2.11", +  graph_video_url: "https://graph-video.facebook.com/v2.8" +``` +Note that you *must not* end the urls with a slash or the requests will fail (Facebook will report an error about unknown url components)! + +Supplying an appsecret is optional. If you supply it, an [appsecret_proof](https://developers.facebook.com/docs/graph-api/securing-requests) will be submitted along with the Graph API requests. The appsecret can be changed (or set) at runtime using `Facebook.set_appsecret("")`. + ## Usage 1. Register an application on [developer.facebook.com](https://developer.facebook.com) diff --git a/mix.exs b/mix.exs index a8bc5b3..1410cd8 100644 --- a/mix.exs +++ b/mix.exs @@ -23,8 +23,8 @@ defmodule Facebook.Mixfile do applications: [:httpoison, :json, :logger], env: [ env: :dev, - graph_url: "https://graph.facebook.com/v2.9", - graph_video_url: "https://graph-video.facebook.com/v2.9", + graph_url: "https://graph.facebook.com", + graph_video_url: "https://graph-video.facebook.com", appsecret: nil ] ]