Skip to content

Commit

Permalink
Fix local JWT auth (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
logan-stytch authored Dec 15, 2023
1 parent ccaaf30 commit d43e139
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions lib/stytch/sessions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,13 @@ def authenticate_jwt(
end

session = authenticate_jwt_local(session_jwt, max_token_age_seconds: max_token_age_seconds)
if !session.nil?
{ 'session' => session }
else
authenticate(
session_jwt: session_jwt,
session_duration_minutes: session_duration_minutes,
session_custom_claims: session_custom_claims
)
end
return session unless session.nil?

authenticate(
session_jwt: session_jwt,
session_duration_minutes: session_duration_minutes,
session_custom_claims: session_custom_claims
)
rescue StandardError
# JWT could not be verified locally. Check with the Stytch API.
authenticate(
Expand Down
2 changes: 1 addition & 1 deletion lib/stytch/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Stytch
VERSION = '7.0.2'
VERSION = '7.0.3'
end

0 comments on commit d43e139

Please sign in to comment.