Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Add facebook grant_type to devise_oauth2_providable

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 tests
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 oauth2_facebook_grantable.gemspec
README.md

oauth2_facebook_grantable

Adds a grant_type "facebook" to the existing installation of devise_oauth2_providable

Features

  • Allows to provide facebook_id and facebook_access_token to authenticate against an OAuth2 API made with devise_oauth2_providable

Requirements

Installation

Install gem

# Gemfile
gem 'oauth2_facebook_grantable'

Migrate database

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

Configure User model to support Facebook authentication

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

Using with Facebook grant_type on the client-side

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)

Contributing

  • Fork the project
  • Fix the issue
  • Add unit tests
  • Submit pull request on github

License

Copyright (C) 2012 Pierre-Luc Simard See LICENSE.txt for further details.

Something went wrong with that request. Please try again.