OmniAuth strategy for authenticating with Fluence AppCenter via OAuth2.
Add this line to your application's Gemfile:
source 'https://rubygems.pkg.github.com/fluence-eu' do
gem 'omniauth-appcenter'
endAnd then execute:
bundle installAdd the provider to your OmniAuth initializer:
# config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :app_center,
ENV['APPCENTER_CLIENT_ID'],
ENV['APPCENTER_CLIENT_SECRET']
endIf you're using Devise, add the provider to your Devise configuration:
# config/initializers/devise.rb
Devise.setup do |config|
config.omniauth :app_center,
ENV['APPCENTER_CLIENT_ID'],
ENV['APPCENTER_CLIENT_SECRET']
endYou can specify a custom redirect URI:
provider :app_center,
ENV['APPCENTER_CLIENT_ID'],
ENV['APPCENTER_CLIENT_SECRET'],
redirect_uri: 'https://your-app.com/auth/app_center/callback'After authentication, OmniAuth will provide the following hash:
{
provider: 'app_center',
uid: '123456',
info: {
email: 'user@example.com'
},
credentials: {
token: 'access_token',
refresh_token: 'refresh_token',
expires_at: 1234567890,
expires: true
},
extra: {
raw_info: {
uid: '123456',
email: 'user@example.com'
}
}
}| Option | Default | Description |
|---|---|---|
scope |
user |
OAuth2 scope for the authorization request |
redirect_uri |
OmniAuth default | Custom callback URL |
After checking out the repo, run bin/setup to install dependencies. 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.
Bug reports and pull requests are welcome on GitHub at https://github.com/fluence-eu/omniauth-appcenter.
The gem is available as open source under the terms of the MIT License.