Giter Club home page Giter Club logo

omniauth-auth0's Introduction

OmniAuth Auth0

An OmniAuth strategy for authenticating with Auth0. This strategy is based on the OmniAuth OAuth2 strategy.

Important security note: The parent library for this strategy currently has an unresolved security issue. Please see the discussion, including mitigations for Rails and non-Rails applications, here.

CircleCI codecov Gem Version MIT licensed

Table of Contents

Documentation

Installation

Add the following line to your Gemfile:

gem 'omniauth-auth0'

If you're using this strategy with Rails, also add the following for CSRF protection:

gem 'omniauth-rails_csrf_protection'

Then install:

$ bundle install

See our contributing guide for information on local installation for development.

Getting Started

To start processing authentication requests, the following steps must be performed:

  1. Initialize the strategy
  2. Configure the callback controller
  3. Add the required routes
  4. Trigger an authentication request

All of these tasks and more are covered in our Ruby on Rails Quickstart.

Additional authentication parameters

To send additional parameters during login, you can specify them when you register the provider:

provider 
  :auth0,
  ENV['AUTH0_CLIENT_ID'],
  ENV['AUTH0_CLIENT_SECRET'],
  ENV['AUTH0_DOMAIN'],
  {
    authorize_params: {
      scope: 'openid read:users write:order',
      audience: 'https://mydomain/api',
      max_age: 3600 # time in seconds authentication is valid
    }
  }

... which will tell the strategy to send those parameters on every authentication request.

Authentication hash

The Auth0 strategy will provide the standard OmniAuth hash attributes:

  • :provider - the name of the strategy, in this case auth0
  • :uid - the user identifier
  • :info - the result of the call to /userinfo using OmniAuth standard attributes
  • :credentials - tokens requested and data
  • :extra - Additional info obtained from calling /userinfo in the :raw_info property
{
  :provider => 'auth0',
  :uid => 'auth0|USER_ID',
  :info => {
    :name => 'John Foo',
    :email => '[email protected]',
    :nickname => 'john',
    :image => 'https://example.org/john.jpg'
  },
  :credentials => {
    :token => 'ACCESS_TOKEN',
    :expires_at => 1485373937,
    :expires => true,
    :refresh_token => 'REFRESH_TOKEN',
    :id_token => 'JWT_ID_TOKEN',
    :token_type => 'bearer',
  },
  :extra => {
    :raw_info => {
      :email => '[email protected]',
      :email_verified => 'true',
      :name => 'John Foo',
      :picture => 'https://example.org/john.jpg',
      :user_id => 'auth0|USER_ID',
      :nickname => 'john',
      :created_at => '2014-07-15T17:19:50.387Z'
    }
  }
}

Contribution

We appreciate feedback and contribution to this repo! Before you get started, please see the following:

Support + Feedback

  • Use Community for usage, questions, specific cases.
  • Use Issues here for code-level support and bug reports.
  • Paid customers can use Support to submit a trouble ticket for production-affecting issues.

Vulnerability Reporting

Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.

What is Auth0?

Auth0 helps you to easily:

  • implement authentication with multiple identity providers, including social (e.g., Google, Facebook, Microsoft, LinkedIn, GitHub, Twitter, etc), or enterprise (e.g., Windows Azure AD, Google Apps, Active Directory, ADFS, SAML, etc.)
  • log in users with username/password databases, passwordless, or multi-factor authentication
  • link multiple user accounts together
  • generate signed JSON Web Tokens to authorize your API calls and flow the user identity securely
  • access demographics and analytics detailing how, when, and where users are logging in
  • enrich user profiles from other data sources using customizable JavaScript rules

Why Auth0?

License

The OmniAuth Auth0 strategy is licensed under MIT - LICENSE

omniauth-auth0's People

Contributors

hzalaz avatar ezequielm avatar joshcanhelp avatar jfromaniello avatar ntotten avatar davidpatrick avatar annyv2 avatar lbalmaceda avatar vmartynets avatar benschwarz avatar pose avatar batalla3692 avatar stefanwork avatar damieng avatar thomsbg avatar ryan-rosenfeld avatar sandrinodimattia avatar lindseyb avatar deepak avatar chills42 avatar jghaines avatar jeffreylees avatar l4u avatar dentarg avatar rahuldess avatar rolodato avatar chenkie avatar siacomuzzi avatar tomgi avatar yvonnewilson avatar

Watchers

James Cloos 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.