MSALNativeAuthFlowDelegate
@objc
public protocol MSALNativeAuthFlowDelegate
Shared base delegate for all Native Auth V2 (server-driven) flows.
Unlike V1 - which exposes a different delegate protocol per step - V2 uses one
family of delegates for sign up, sign in and reset password. The SDK drives the flow and
reports back through these callbacks; the app reacts and continues the flow by
calling methods directly on the MSALNativeAuthState it is handed.
This base protocol declares only the two terminal callbacks (onFlowCompleted(result:scenario:)
and onFlowError(error:scenario:)) that every flow reports. Each server-driven state is
delivered through its own per-state delegate protocol (e.g. MSALNativeAuthCodeRequiredDelegate)
that extends this base and adds a single strongly-typed, required callback. The app conforms to
the per-state protocols for the states it wants to handle; if it does not conform to a state’s
protocol, onFlowError(error:scenario:) is called with error type notImplemented.
All callbacks are invoked on the main actor.
Warning
This API is experimental. It may be changed in the future without notice. Do not use in production applications.-
The flow completed successfully and the user now has tokens.
Declaration
Swift
@MainActor func onFlowCompleted(result: MSALNativeAuthUserAccountResult, scenario: MSALNativeAuthFlowScenario)Parameters
resultThe authenticated user account result.
scenarioThe flow that produced this callback.
-
The flow encountered an error.
Declaration
Swift
@MainActor func onFlowError(error: MSALNativeAuthFlowError, scenario: MSALNativeAuthFlowScenario)Parameters
errorThe error that occurred. The app decides whether it can retry by inspecting the error (e.g.
error.isInvalidCode/error.isInvalidPassword) and calling the appropriate method again on the state it is currently handling.scenarioThe flow that produced this callback.
View on GitHub