Skip to content

Commit

Permalink
Return if access_token is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
BobbyMcWho committed Apr 18, 2022
1 parent 289e645 commit defc376
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/omniauth-okta/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module OmniAuth
module Okta
VERSION = '1.0.0'.freeze
VERSION = '2.0.0'.freeze
end
end
2 changes: 2 additions & 0 deletions lib/omniauth/strategies/okta.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def callback_url
end

def id_token
return if access_token.nil?

access_token['id_token']
end

Expand Down
8 changes: 8 additions & 0 deletions spec/omniauth/strategies/okta_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@
end

it { expect(subject.id_token).to eq(id_token_string) }

context 'when access token is nil' do
before do
allow(subject).to receive(:access_token).and_return(nil)
end

it { expect(subject.id_token).to be_nil }
end
end

describe 'raw_info' do
Expand Down

0 comments on commit defc376

Please sign in to comment.