{"id":18524382,"url":"https://github.com/omniauth/omniauth-okta","last_synced_at":"2025-06-14T17:33:27.990Z","repository":{"id":42011471,"uuid":"93338824","full_name":"omniauth/omniauth-okta","owner":"omniauth","description":"OAuth2 strategy for Okta","archived":false,"fork":false,"pushed_at":"2023-10-06T17:55:55.000Z","size":36,"stargazers_count":42,"open_issues_count":10,"forks_count":37,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-24T05:24:16.683Z","etag":null,"topics":["oauth2","okta","omniauth","omniauth-oauth2","omniauth-strategy","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/omniauth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-04T20:13:49.000Z","updated_at":"2024-12-06T20:15:53.000Z","dependencies_parsed_at":"2024-11-06T17:49:48.789Z","dependency_job_id":"ad2954db-974f-42b1-bd11-b39f9d81dca3","html_url":"https://github.com/omniauth/omniauth-okta","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omniauth%2Fomniauth-okta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omniauth%2Fomniauth-okta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omniauth%2Fomniauth-okta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omniauth%2Fomniauth-okta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omniauth","download_url":"https://codeload.github.com/omniauth/omniauth-okta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248031642,"owners_count":21036446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["oauth2","okta","omniauth","omniauth-oauth2","omniauth-strategy","ruby"],"created_at":"2024-11-06T17:41:10.628Z","updated_at":"2025-04-09T11:32:01.657Z","avatar_url":"https://github.com/omniauth.png","language":"Ruby","readme":"# OmniAuth Okta OAuth2 Strategy\n\nStrategy to authenticate with Okta via OAuth2 in OmniAuth.\n\nThis strategy uses Okta's OpenID Connect API with OAuth2. See their [developer docs](https://developer.okta.com/docs/api/resources/oidc.html) for more details.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'omniauth-okta'\n```\n\nAnd then execute:\n```bash\n$ bundle install\n```\n\nOr install it yourself as:\n```bash\n$ gem install omniauth-okta\n```\n\n### OmniAuth\n\nHere's an example for adding the middleware to a Rails app in `config/initializers/omniauth.rb`:\n\n```ruby\nRails.application.config.middleware.use OmniAuth::Builder do\n  provider :okta, ENV['OKTA_CLIENT_ID'], ENV['OKTA_CLIENT_SECRET'], {\n    client_options: {\n      site:                 'https://your-org.okta.com',\n      authorization_server: '\u003cauthorization_server\u003e',\n      authorize_url:        'https://your-org.okta.com/oauth2/\u003cauthorization_server\u003e/v1/authorize',\n      token_url:            'https://your-org.okta.com/oauth2/\u003cauthorization_server\u003e/v1/token',\n      user_info_url:        'https://your-org.okta.com/oauth2/\u003cauthorization_server\u003e/v1/userinfo',\n      audience:             'api://your-audience'\n    }\n  }\nend\n```\n\n### Devise\n\nFirst define your application id and secret in `config/initializers/devise.rb`.\n\nConfiguration options can be passed as the last parameter here as key/value pairs.\n\n```ruby\nconfig.omniauth :okta, ENV['OKTA_CLIENT_ID'], ENV['OKTA_CLIENT_SECRET'], {}\n```\nor add options like the following:\n\n```ruby\n  require 'omniauth-okta'\n  config.omniauth(:okta,\n                  ENV['OKTA_CLIENT_ID'],\n                  ENV['OKTA_CLIENT_SECRET'],\n                  scope: 'openid profile email',\n                  fields: ['profile', 'email'],\n                  client_options: {\n                    site:          'https://your-org.okta.com',\n                    authorize_url: 'https://your-org.okta.com/oauth2/default/v1/authorize',\n                    token_url:     'https://your-org.okta.com/oauth2/default/v1/token',\n                    user_info_url: 'https://your-org.okta.com/oauth2/default/v1/userinfo',\n                  },\n                  strategy_class: OmniAuth::Strategies::Okta)\n```\n\nThen add the following to 'config/routes.rb' so the callback routes are defined.\n\n```ruby\ndevise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }\n```\n\nMake sure your model is omniauthable. Generally this is \"/app/models/user.rb\"\n\n```ruby\ndevise :omniauthable, omniauth_providers: [:okta]\n```\n\n## Auth Hash\n\nHere's an example of an authentication hash available in the callback by accessing `request.env['omniauth.auth']`:\n\n```ruby\n{\n  \"provider\" =\u003e \"okta\",\n  \"uid\" =\u003e \"0000000000000001\",\n  \"info\" =\u003e {\n    \"name\" =\u003e \"John Smith\",\n    \"email\" =\u003e \"john@example.com\",\n    \"first_name\" =\u003e \"John\",\n    \"last_name\" =\u003e \"Smith\",\n    \"image\" =\u003e \"https://photohosting.com/john.jpg\"\n  },\n  \"credentials\" =\u003e {\n    \"token\" =\u003e \"TOKEN\",\n    \"expires_at\" =\u003e 1496617411,\n    \"expires\" =\u003e true\n  },\n  \"extra\" =\u003e {\n    \"raw_info\" =\u003e {\n      \"sub\" =\u003e \"0000000000000001\",\n      \"name\" =\u003e \"John Smith\",\n      \"locale\" =\u003e \"en-US\",\n      \"email\" =\u003e \"john@example.com\",\n      \"picture\" =\u003e \"https://photohosting.com/john.jpg\",\n      \"website\" =\u003e \"https://example.com\",\n      \"preferred_username\" =\u003e \"john@example.com\",\n      \"given_name\" =\u003e \"John\",\n      \"family_name\" =\u003e \"Smith\",\n      \"zoneinfo\" =\u003e \"America/Los_Angeles\",\n      \"updated_at\" =\u003e 1496611646,\n      \"email_verified\" =\u003e true\n    },\n    \"id_token\" =\u003e \"TOKEN\",\n    \"id_info\" =\u003e {\n      \"ver\" =\u003e 1,\n      \"jti\" =\u003e \"AT.D2sslkfjdsldjf899n090sldkfj\",\n      \"iss\" =\u003e \"https://your-org.okta.com\",\n      \"aud\" =\u003e \"https://your-org.okta.com\",\n      \"sub\" =\u003e \"john@example.com\",\n      \"iat\" =\u003e 1496613811,\n      \"exp\" =\u003e 1496617411,\n      \"cid\" =\u003e \"CLIENT_ID\",\n      \"uid\" =\u003e \"0000000000000001\",\n      \"scp\" =\u003e [\"email\", \"profile\", \"openid\"]\n    }\n  }\n}\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## License\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomniauth%2Fomniauth-okta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomniauth%2Fomniauth-okta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomniauth%2Fomniauth-okta/lists"}