Skip to content

Add an option which allows use of Okta's org authorization server #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/omniauth/strategies/okta.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class Okta < OmniAuth::Strategies::OAuth2
user_info_url: 'https://your-org.okta.com/oauth2/default/v1/userinfo',
response_type: 'id_token',
authorization_server: 'default',
audience: 'api://default'
audience: 'api://default',
use_org_auth_server: false
}
option :scope, DEFAULT_SCOPE

Expand Down Expand Up @@ -74,10 +75,14 @@ def id_token
# This is necessary in the case where there is a custom authorization server.
#
# Okta provides a default, by default.
# There is also an option to use an org authorization server if a custom authorization server is not available
# in your Okta subscription, set a use_org_auth_server client option to true.
#
# @return [String]
def authorization_server_path
site = client_options.fetch(:site)
site = client_options.fetch(:site)
return site if client_options.fetch(:use_org_auth_server)

authorization_server = client_options.fetch(:authorization_server, 'default')

"#{site}/oauth2/#{authorization_server}"
Expand Down