Giter Club home page Giter Club logo

omniauth-gengo's Introduction

OmniAuth for Gengo

Gengo OAuth2 Strategy for OmniAuth 1.0.

Supports the OAuth 2.0 server-side. Read the Gengo docs for more details: https://gengo.com/docs

Installing

Add to your Gemfile:

gem 'omniauth-gengo'

Then bundle install.

Usage

OmniAuth::Strategies::Gengo is simply a Rack middleware. Read the OmniAuth 1.0 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:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :gengo, ENV['GENGO_KEY'], ENV['GENGO_SECRET']
end

Configuring

You can configure several options, which you pass in to the provider method via a Hash:

  • scope: A comma-separated list of permissions you want to request from the user. See the Gengo docs for a full list of available permissions. Default: email.
  • display: The display context to show the authentication page. Options are: web, desktop and mobile. Default: web.

For example, to request email permission and display the authorization page in a mobile app:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :gengo, ENV['GENGO_KEY'], ENV['GENGO_SECRET'], :scope => 'email', :display => 'mobile'
end

If you want to set the display format on a per-request basis, you can just pass it to the OmniAuth request phase URL, for example: /auth/gengo?display=popup.

Authentication Hash

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

{
  :provider => 'gengo',
  :uid => '123',
  :info => {
    :first_name => 'Alex',
    :last_name => 'Thompson',
    :email => '[email protected]',
    :name => 'Alex Thompson'
  },
  :credentials => {
    :token => 'ABCDEF...', 			# OAuth 2.0 access_token
    :expires_at => 1321747205 	# when the access token expires
  },
  :extra => {
    :user => {
      :id => '1234567',
      :name => 'Alex Thompson',
      :first_name => 'Alex',
      :last_name => 'Thompson'
    }
  }
}

The precise information available may depend on the permissions which you request.

omniauth-gengo's People

Contributors

berk avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.