All Projects → omniauth → omniauth-okta

omniauth / omniauth-okta

Licence: MIT license
OAuth2 strategy for Okta

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to omniauth-okta

httpx auth
Authentication classes to be used with httpx
Stars: ✭ 59 (+103.45%)
Mutual labels:  oauth2, okta
okta-spring-security-5-example
Authentication with Spring Security 5 and Okta OIDC
Stars: ✭ 16 (-44.83%)
Mutual labels:  oauth2, okta
schematics
Schematics for adding Okta Auth to your projects
Stars: ✭ 60 (+106.9%)
Mutual labels:  oauth2, okta
omniauth-kerberos
OmniAuth strategy for kerberos authentication.
Stars: ✭ 13 (-55.17%)
Mutual labels:  omniauth, omniauth-strategy
wiresteward
Wireguard peer manager
Stars: ✭ 50 (+72.41%)
Mutual labels:  oauth2
remix-auth
Simple Authentication for Remix
Stars: ✭ 929 (+3103.45%)
Mutual labels:  oauth2
logto
🧑‍🚀 Logto helps you build the sign-in, auth, and user identity within minutes. We provide an OIDC-based identity service and the end-user experience with username, phone number, email, and social sign-in, with extendable multi-language support.
Stars: ✭ 3,421 (+11696.55%)
Mutual labels:  oauth2
python-tokens
Python library to manage OAuth access tokens
Stars: ✭ 14 (-51.72%)
Mutual labels:  oauth2
mantle
📒 Easy and effective communication for any team or community.
Stars: ✭ 30 (+3.45%)
Mutual labels:  oauth2
portal
A hub-and-spoke platform for organizations to effectively manage their operations and data. Uses GSuite.
Stars: ✭ 26 (-10.34%)
Mutual labels:  oauth2
cordova-spotify-oauth
🔐 Easy Spotify authentication for Cordova / PhoneGap apps
Stars: ✭ 15 (-48.28%)
Mutual labels:  oauth2
sample-oauth2-client
Sample OAuth2 client using the GitHub API
Stars: ✭ 69 (+137.93%)
Mutual labels:  oauth2
OAuth2-Go
OAuth2 sample app using Go
Stars: ✭ 19 (-34.48%)
Mutual labels:  oauth2
ansible-okta-modules
Ansible modules for the Okta API
Stars: ✭ 24 (-17.24%)
Mutual labels:  okta
OAuthLogin.AspNetCore
第三方平台联合登陆(facebook、微信、微博、QQ、Kakao)
Stars: ✭ 43 (+48.28%)
Mutual labels:  oauth2
Slack
[READ ONLY] Subtree split of the SocialiteProviders/Slack Provider (see SocialiteProviders/Providers)
Stars: ✭ 11 (-62.07%)
Mutual labels:  oauth2
gabrielsroka.github.io
My website, including rockstar: Export Okta Users, Groups, etc. to CSV. Show SAML assertion.
Stars: ✭ 62 (+113.79%)
Mutual labels:  okta
OAuthLogin
第三方平台联合登陆(facebook、微信、微博、QQ、Kakao)
Stars: ✭ 57 (+96.55%)
Mutual labels:  oauth2
fastapi-azure-auth
Easy and secure implementation of Azure AD for your FastAPI APIs 🔒 B2C, single- and multi-tenant support.
Stars: ✭ 174 (+500%)
Mutual labels:  oauth2
Simpler
Simpler是一款轻量级的第三方微博应用,具有微博的基础功能,兼有外观优雅,运行流畅,内存占用低,省电省流量等特点。
Stars: ✭ 27 (-6.9%)
Mutual labels:  oauth2

OmniAuth Okta OAuth2 Strategy

Strategy to authenticate with Okta via OAuth2 in OmniAuth.

This strategy uses Okta's OpenID Connect API with OAuth2. See their developer docs for more details.

Installation

Add this line to your application's Gemfile:

gem 'omniauth-okta'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install omniauth-okta

OmniAuth

Here's an example for adding the middleware to a Rails app in config/initializers/omniauth.rb:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :okta, ENV['OKTA_CLIENT_ID'], ENV['OKTA_CLIENT_SECRET'], {
    client_options: {
      site:                 'https://your-org.okta.com',
      authorization_server: '<authorization_server>',
      authorize_url:        'https://your-org.okta.com/oauth2/<authorization_server>/v1/authorize',
      token_url:            'https://your-org.okta.com/oauth2/<authorization_server>/v1/token',
      user_info_url:        'https://your-org.okta.com/oauth2/<authorization_server>/v1/userinfo',
      audience:             'api://your-audience'
    }
  }
end

Devise

First define your application id and secret in config/initializers/devise.rb.

Configuration options can be passed as the last parameter here as key/value pairs.

config.omniauth :okta, ENV['OKTA_CLIENT_ID'], ENV['OKTA_CLIENT_SECRET'], {}

or add options like the following:

  require 'omniauth-okta'
  config.omniauth(:okta,
                  ENV['OKTA_CLIENT_ID'],
                  ENV['OKTA_CLIENT_SECRET'],
                  scope: 'openid profile email',
                  fields: ['profile', 'email'],
                  client_options: {
                    site:          'https://your-org.okta.com',
                    authorize_url: 'https://your-org.okta.com/oauth2/default/v1/authorize',
                    token_url:     'https://your-org.okta.com/oauth2/default/v1/token',
                    user_info_url: 'https://your-org.okta.com/oauth2/default/v1/userinfo',
                  },
                  strategy_class: OmniAuth::Strategies::Okta)

Then add the following to 'config/routes.rb' so the callback routes are defined.

devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }

Make sure your model is omniauthable. Generally this is "/app/models/user.rb"

devise :omniauthable, omniauth_providers: [:okta]

Auth Hash

Here's an example of an authentication hash available in the callback by accessing request.env['omniauth.auth']:

{
  "provider" => "okta",
  "uid" => "0000000000000001",
  "info" => {
    "name" => "John Smith",
    "email" => "[email protected]",
    "first_name" => "John",
    "last_name" => "Smith",
    "image" => "https://photohosting.com/john.jpg"
  },
  "credentials" => {
    "token" => "TOKEN",
    "expires_at" => 1496617411,
    "expires" => true
  },
  "extra" => {
    "raw_info" => {
      "sub" => "0000000000000001",
      "name" => "John Smith",
      "locale" => "en-US",
      "email" => "[email protected]",
      "picture" => "https://photohosting.com/john.jpg",
      "website" => "https://example.com",
      "preferred_username" => "[email protected]",
      "given_name" => "John",
      "family_name" => "Smith",
      "zoneinfo" => "America/Los_Angeles",
      "updated_at" => 1496611646,
      "email_verified" => true
    },
    "id_token" => "TOKEN",
    "id_info" => {
      "ver" => 1,
      "jti" => "AT.D2sslkfjdsldjf899n090sldkfj",
      "iss" => "https://your-org.okta.com",
      "aud" => "https://your-org.okta.com",
      "sub" => "[email protected]",
      "iat" => 1496613811,
      "exp" => 1496617411,
      "cid" => "CLIENT_ID",
      "uid" => "0000000000000001",
      "scp" => ["email", "profile", "openid"]
    }
  }
}

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

The gem is available as open source under the terms of the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].