Apr 27, 2014

Facebook::OpenGraph 1.20 w/ JS SDK's cookie support is now available

Facebook::OpenGraph 1.20 is now available.

Work with JS SDK

Among 2 newly added features, one deals with cookie that is set by JS SDK. Detailed implementation process can be seen at github issue. $fb->js_cookie_name will give you the name of the cookie and $fb->get_user_token_by_cookie( $cookie_value ) will hit auth endpoint and exchange cookie value to user access token. Sample usage is shown as below:

Access Response Header

The other feature deals with response header. $res->header( $header_field_name ) provides access to any given header field. As a shorthand $res->etag is provided since $fb->fetch_with_etag supports access with etag value. Other than ETag header field there are some fields that you should know: X-FB-Rev and X-FB-Debug. As described in official blog entry, X-FB-Rev indicate Facebook Platform's internal revision number. Official document is not provided for X-FB-Debug, but it must be something that help resolving their issue. So when you get error response even though your request seems legitimate, you might want to check $res->header(''x-fb-rev) and $res->header('x-fb-debug') and report them on bug report.