Helps OmniAuth to be used in a stateless manner (e.g. with REST APIs) by authenticating during each request.
A REST API contains resources that require authentication through Facebook Single Sign-On on Android or iOS.
Normally OmniAuth works by intercepting requests for certain paths (/auth/:provider/...) that are used for logging in and out. For stateless applications we essentially wish to log in during each request. This gem provides Rack middleware for authenticating on every request where credentials are provided.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install omniauth-stateless
Set up omniauth as normal.
Add this to config/application.rb
Add this to config/routes.rb
mount OmniAuth::Stateless::Engine => '/'
Create your controller like this
class Api::ItemsController < OmniAuth::Stateless::BaseController before_action :require_auth, only: [:create] respond_to :json def create ... end end
Connect from your client like this
git checkout -b my-new-feature)
git commit -am 'Add some feature')
git push origin my-new-feature)