Skip to content

foxford/omniauth-tinkoff-id

Repository files navigation

T-Id OAuth strategy for OmniAuth

Ruby

sponsored by foxford

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

  1. 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
    
  2. Add route

     get '/auth/:provider/callback', to: 'sessions#create'
    
  3. 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

  1. Fork it (https://github.com/foxford/omniauth-tinkoff-id/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. 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