OmniAuth::AinewsAuth
AinewsAuth omniauth-oauth2 provider used to authenticate users with
https://b2b.ainews.kz/login/ or https://dev-auth.dev.b2b.aitudala.net/login
Installation
Add this line to your application's Gemfile:
gem 'omniauth-ainews-auth'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install omniauth-ainews-auth
Usage
- Add it to your Gemfile:
gem 'omniauth-ainews-auth
- Bundle it:
$ bundle install
- Add provider to your omniauth initializer
Rails.application.config.middleware.use OmniAuth::Builder do
provider :ainews_auth,
ENV['AINEWS_CLIENT_ID'],
ENV['AINEWS_CLIENT_SECRET'],
{
provider_ignores_state: Rails.env == 'production' ? false : true,
token_params: {
redirect_uri: ENV['AINEWS_REDIRECT_URI'],
client_id: ENV['AINEWS_CLIENT_ID'],
client_secret: ENV['AINEWS_CLIENT_SECRET']
},
client_options: {
redirect_uri: ENV['AINEWS_REDIRECT_URI']
}
}
end
OmniAuth.config.logger = Rails.logger
using the keys you receive and URI you provided when registered the app
- 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']
Also you can switch between production and dev auth stand using key
ENV['AINEWS_AUTH_DEV'] = true
- Enjoy!
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
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 GitLab at https://gitlab.btsd.kz/news-saas/b2b-auth-gem. 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.