OmniAuth::AituPassport

Gem Version

AituPassport omniauth-oauth2 provider used to authenticate users with https://passport.aitu.io/

described here https://docs.aitu.io/aituapps/aitu-passport/aitu-passport-api#poluchenie-dannykh-polzovatelya

Installation

Add this line to your application's Gemfile:

gem 'omniauth-aitu-passport'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install omniauth-aitu-passport

Usage

  1. Add it to your Gemfile:

    gem 'omniauth-aitu-passport'
    
  2. Bundle it:

$ bundle install
  1. Add provider to your omniauth initializer
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :aitu_passport,
           ENV['PASSPORT_KEY'],
           ENV['PASSPORT_SECRET'],
           {
             scope: 'phone first_name middle_name last_name gender openid',
             response_type: 'code',
             client_id: ENV['PASSPORT_KEY'],
             provider_ignores_state: Rails.env == 'production' ? false : true,
             redirect_uri: ENV['PASSPORT_REDIRECT_URI'],
             token_params: {
               redirect_uri: ENV['PASSPORT_REDIRECT_URI']
             }
           }
end

OmniAuth.config.logger = Rails.logger

using the keys you receive and URI you provided when registered the app

Please note :redirect_uri param under :token_params is mandatory option.

Also, you can use

ENV['PASSPORT_STAGING']: true

option in your environment to send auth requests to staging AituPassport server, e.g. https://passport.stage.supreme-team.tech

  1. Use it in your sessions controller on your own, assuming the following envs to store the data you need

    request.env['omniauth.auth']

    request.env['omniauth.params']

  1. Enjoy!

Development

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/yvshevchenko/omniauth-aitu-passport. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Omniauth::Aitu::Passport project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.