public final class HaapiManager: NSObject

HaapiManager manages the communication flow between a client and the Curity Identity Server by providing data models objects for the different steps of the flow, which can be used in the UI components of the client application.

A HAAPI flow can be initiated by calling the start function, which will provide a first result. Afterwards, use either submitForm or followLink to move forward. All these methods return an HaapiResult, which encloses a HaapiRepresentation, a ProblemRepresentation or an Error.

A HaapiRepresentation represents a new step in the flow. A ProblemRepresentation indicates that a problem has occurred. An Error encloses an exception, in which case the flow should be stopped.

The purpose of using this class is to obtain an OAuthAuthorizationResponseStep that contains the authorization response details.



public static var isSupported: Bool

A Boolean that indicates whether HAAPI is supported on a particular device.



public init(haapiConfiguration: HaapiConfigurable)

Creates an instance of HaapiManager based on the provided HaapiConfigurable.


Name Description
haapiConfiguration The configuration used to build this instance.




public func close()

Closes this instance, which closes the underlying HaapiTokenManager instance.


public func start(_ authorizationParameters: OAuthAuthorizationParameters = OAuthAuthorizationParameters(),
                  completionHandler: @escaping HaapiCompletionHandler)

Starts the HAAPI flow by performing an authorization request.

The client_id, response_type and redirect_uri parameters are always added based on the configuration values.


Name Description
authorizationParameters The authorization request parameters. Empty by default.
completionHandler A completion handler that is called when start is complete. thread/


public func submitForm(_ form: FormActionModel,
                       parameters: [String: Any],
                       completionHandler: @escaping HaapiCompletionHandler)

Submits a form action to move forward in the HAAPI flow.

The parameters supplied to this method override the field values present in the form. If the parameters don't include a value for a given form field name, the original value in the form is used. Parameters whose key is not included in the form fields names are not included in the request


public func followLink(_ link: Link, completionHandler: @escaping HaapiCompletionHandler)

Follows a link to an alternative HAAPI flow.

Links are always followed using a GET request.