Class: StandardId::Oauth::PasswordlessOtpFlow

Inherits:
TokenGrantFlow show all
Defined in:
lib/standard_id/oauth/passwordless_otp_flow.rb

Instance Attribute Summary

Attributes inherited from TokenGrantFlow

#params, #request

Attributes inherited from BaseRequestFlow

#current_account, #params, #request

Instance Method Summary collapse

Methods inherited from TokenGrantFlow

#execute, extra_permitted_keys, #initialize

Methods inherited from BaseRequestFlow

expect_params, expected_params, extra_permitted_keys, #initialize, permit_params, permitted_params

Constructor Details

This class inherits a constructor from StandardId::Oauth::TokenGrantFlow

Instance Method Details

#authenticate!Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/standard_id/oauth/passwordless_otp_flow.rb', line 7

def authenticate!
  validate_client_secret!(params[:client_id], params[:client_secret]) if params[:client_secret].present?
  validate_requested_scope!

  @verification_result = StandardId::Passwordless::VerificationService.verify(
    connection: params[:connection],
    username: params[:username],
    code: params[:otp],
    request: request
  )

  unless @verification_result.success?
    raise StandardId::InvalidGrantError, @verification_result.error
  end
end