No release in over 3 years
OAuth2 Strategy for Facebook Long-Lived User Access Tokens
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.17
~> 0.8
~> 12.3.3
~> 3.0

Runtime

~> 1
 Project Readme

OAuth2 Strategy for Facebook Long-Lived User Access Tokens

Gem Version Coverage Status Maintainability License: MIT

As per Facebook, default User and Page access tokens are short-lived, expiring in hours, however, you can exchange a short-lived token for a long-lived token.

This gem adds a new strategy to the excellent oauth2 gem that can be used to do just that.

Installation

gem install oauth2_fb_exchange_token_strategy

Or inside Gemfile

gem 'oauth2_fb_exchange_token_strategy'

Usage Examples

require 'oauth2'
require 'oauth2_fb_exchange_token_strategy'
client = OAuth2::Client.new('client_id', 'client_secret', site: 'https://graph.facebook.com/v9.0', authorize_url: 'https://www.facebook.com/v8.0/dialog/oauth', token_url: 'oauth/access_token')

short_lived_token = client.auth_code.get_token('authorization_code_value', redirect_uri: 'http://example.org/oauth2/callback')
token = client.fb_exchange_token.get_token(short_lived_token.token)
# => OAuth2::AccessToken