项目作者: eventpop

项目描述 :
Eventpop OAuth2 Strategy for OmniAuth.
高级语言: Ruby
项目地址: git://github.com/eventpop/omniauth-eventpop.git
创建时间: 2019-08-20T10:43:10Z
项目社区:https://github.com/eventpop/omniauth-eventpop

开源协议:

下载


OmniAuth Eventpop

Eventpop OAuth2 Strategy for OmniAuth.

Installing

Add to your Gemfile:

  1. gem 'omniauth-eventpop', github: 'eventpop/omniauth-eventpop'

Then bundle install.

Usage

OmniAuth::Strategies::Eventpop is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.

Here’s a quick example, adding the middleware to a Rails app in config/initializers/omniauth.rb:

  1. Rails.application.config.middleware.use OmniAuth::Builder do
  2. provider :eventpop, ENV['EVENTPOP_APP_ID'], ENV['EVENTPOP_APP_SECRET']
  3. end

Auth Hash

Here’s an example Auth Hash available in request.env['omniauth.auth']:

  1. {
  2. provider: 'eventpop',
  3. uid: '1234567',
  4. info: {
  5. email: 'joe@bloggs.com',
  6. full_name: 'Joe Bloggs'
  7. },
  8. credentials: {
  9. token: 'ABCDEF...', # OAuth 2.0 access_token, which you may wish to store
  10. expires_at: 1321747205, # when the access token expires (it always will)
  11. expires: true # this will always be true
  12. },
  13. extra: {
  14. raw_info: {
  15. id: '1234567',
  16. full_name: 'Joe Bloggs',
  17. email: 'joe@bloggs.com',
  18. # ...
  19. }
  20. }
  21. }