Weavr.StepUp (Weavr v1.0.0)

Copy Markdown View Source

Step-up authentication challenges (SCA / PSD2).

Step-up authentication is required when performing certain requests covered by PSD2 Strong Customer Authentication requirements — for example, creating a Managed Account or initiating an OWT.

The flow is:

  1. Attempt the protected operation → receive a 403 with step-up challenge details (or a STEP_UP_REQUIRED error code)
  2. Call initiate_otp/3 to send an OTP to the user's enrolled device
  3. User enters the code → call verify_otp/4
  4. The token returned from verify_otp/4 is a stepped-up token — retry the original operation with this token

Confirmed endpoints (from Weavr error-handling docs and curl examples)

  • POST /stepup/challenges/otp/{channel} — initiate step-up OTP challenge
  • POST /stepup/challenges/otp/{channel}/verify — verify the OTP code

Channels

Currently supported channels: "SMS", "AUTHY" (Twilio Authy push notification).

Sandbox note

On Sandbox, the verification code is always "123456".

Summary

Functions

Initiates a step-up OTP challenge on the given channel.

The supported step-up OTP channels.

Verifies a step-up OTP code and returns a stepped-up token.

Functions

initiate_otp(config, auth_token, channel)

@spec initiate_otp(Weavr.Config.t(), String.t(), String.t()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}

Initiates a step-up OTP challenge on the given channel.

POST /stepup/challenges/otp/{channel}

channel must be one of ["SMS", "AUTHY"].

On Sandbox, the OTP code is always "123456".

supported_channels()

@spec supported_channels() :: [String.t()]

The supported step-up OTP channels.

verify_otp(config, auth_token, channel, verification_code)

@spec verify_otp(Weavr.Config.t(), String.t(), String.t(), String.t()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}

Verifies a step-up OTP code and returns a stepped-up token.

POST /stepup/challenges/otp/{channel}/verify

On success, use the returned token for the operation that required step-up authentication. On Sandbox the code is always "123456".