Sha256: d32b24bb37f96cb274aed10645f65e3c96a8c7537e468b0721518d10b84f4c66

Contents?: true

Size: 941 Bytes

Versions: 14

Compression:

Stored size: 941 Bytes

Contents

# frozen_string_literal: true

require_relative 'request_helper'

module Stytch
  class OAuth
    include Stytch::RequestHelper

    PATH = '/v1/oauth'

    def initialize(connection)
      @connection = connection
    end

    def authenticate(
      token:,
      session_token: nil,
      session_jwt: nil,
      session_duration_minutes: nil,
      session_custom_claims: nil,
      code_verifier: nil
    )
      request = {
        token: token
      }
      request[:session_token] = session_token unless session_token.nil?
      request[:session_jwt] = session_jwt unless session_jwt.nil?
      request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
      request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
      request[:code_verifier] = code_verifier unless code_verifier.nil?

      post_request("#{PATH}/authenticate", request)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
stytch-4.1.0 lib/stytch/oauth.rb
stytch-4.0.0 lib/stytch/oauth.rb
stytch-3.15.0 lib/stytch/oauth.rb
stytch-3.14.0 lib/stytch/oauth.rb
stytch-3.13.1 lib/stytch/oauth.rb
stytch-3.13.0 lib/stytch/oauth.rb
stytch-3.12.0 lib/stytch/oauth.rb
stytch-3.11.0 lib/stytch/oauth.rb
stytch-3.10.0 lib/stytch/oauth.rb
stytch-3.9.0 lib/stytch/oauth.rb
stytch-3.8.0 lib/stytch/oauth.rb
stytch-3.7.0 lib/stytch/oauth.rb
stytch-3.6.0 lib/stytch/oauth.rb
stytch-3.5.0 lib/stytch/oauth.rb