Adds a grant_type "facebook" to the existing installation of devise_oauth2_providable
- Allows to provide facebook_id and facebook_access_token to authenticate against an OAuth2 API made with devise_oauth2_providable
- Devise authentication library
- Rails 3.1 or higher
- Devise OAuth2 Providable
# Gemfile
gem 'oauth2_facebook_grantable'
It essentially adds a facebook_identifier column to the User model. It's required so the plugin can find a user based on its facebook_id
$ rails g oauth2_facebook_grantable:install
$ rake db:migrate
Add :oauth2_facebook_grantable
to your devise
declaration as seen bellow.
class User
devise :oauth2_providable,
:oauth2_password_grantable,
:oauth2_refresh_token_grantable,
:oauth2_facebook_grantable
end
To authentitcate against to the API using Facebook credentials you need to post
the API with the parameter facebook_identifier
and facebook_access_token
as
shown bellow:
post("/oauth/token",
:format => :json,
:facebook_identifier => facebook_id,
:facebook_access_token => facebook_access_token,
:grant_type => "facebook",
:client_secret => client_secret,
:client_id => client_identifier)
- Fork the project
- Fix the issue
- Add unit tests
- Submit pull request on github
Copyright (C) 2012 Pierre-Luc Simard See LICENSE.txt for further details.