T-Id OAuth strategy for OmniAuth
Getting Started
Prerequisites
This gem require OmniAuth
But you no need add gem 'omniauth'
.
This gem already added.
Installation
gem "omniauth-tinkoff-id"
Join to TinkoffId
Usage
-
Add to omniauth.rb tinkoff_id provider:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :tinkoff_id, ENV['TINKOFF_CLIENT_ID'], ENV['TINKOFF_CLIENT_SECRET']
end
-
Add route
get '/auth/:provider/callback', to: 'sessions#create'
-
Create SessionController
note: This controller only as example how to create user by callback
class SessionsController < ApplicationController
def create
@user = User.find_or_create_from_auth_hash(auth_hash)
redirect_to '/'
end
protected
def auth_hash
request.env['omniauth.auth']
end
end
Contributing
- Fork it (https://github.com/foxford/omniauth-tinkoff-id/fork)
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Versioning
We use SemVer for versioning. For the versions available,
see the tags on this repository.
Authors
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License.
Acknowledgments