MSALNativeAuthPublicClientApplication

@objcMembers
public final class MSALNativeAuthPublicClientApplication : MSALPublicClientApplication

Main interface to interact with the Native Auth methods

To create an instance of the MSALNativeAuthPublicClientApplication use the clientId, tenantSubdomain, challengeTypes and redirectUri (optional) to the initialiser method.

For example:

    do {
        let config = try MSALNativeAuthPublicClientApplicationConfig(
            clientId: "Enter_the_Application_Id_Here",
            tenantSubdomain: "Enter_the_Tenant_Subdomain_Here",
            challengeTypes: [.OOB]
         )
        nativeAuth = try MSALNativeAuthPublicClientApplication(nativeAuthConfiguration: config)
        print("Initialised Native Auth successfully.")
    } catch {
        print("Unable to initialize MSAL \(error)")
    }
  • Initialize a MSALNativePublicClientApplication with a given configuration

    Throws

    An error that occurred creating the application object

    Declaration

    Swift

    public init(nativeAuthConfiguration: MSALNativeAuthPublicClientApplicationConfig) throws

    Parameters

    nativeAuthConfiguration

    Configuration for native auth PublicClientApplication

  • Initialize a MSALNativePublicClientApplication with a given configuration and challenge types

    Throws

    An error that occurred creating the application object

    Declaration

    Swift

    @available(*, deprecated, message: "Use init(nativeAuthConfiguration: ﹚ instead.")
    public convenience init(
        configuration config: MSALPublicClientApplicationConfig,
        challengeTypes: MSALNativeAuthChallengeTypes) throws

    Parameters

    config

    Configuration for PublicClientApplication

    challengeTypes

    The set of challenge types that this application can support as an MSALNativeAuthChallengeTypes optionset

  • Initialize a MSALNativePublicClientApplication.

    Throws

    An error that occurred creating the application object

    Declaration

    Swift

    @available(*, deprecated, message: "Use init(nativeAuthConfiguration: ﹚ instead.")
    public convenience init(
        clientId: String,
        tenantSubdomain: String,
        challengeTypes: MSALNativeAuthChallengeTypes,
        redirectUri: String? = nil) throws

    Parameters

    clientId

    The client ID of the application, this should come from the app developer portal.

    tenantSubdomain

    The subdomain of the tenant, this should come from the app developer portal.

    challengeTypes

    The set of challenge types that this application can support as an MSALNativeAuthChallengeTypes optionset

    redirectUri

    Optional. The redirect URI for the application, this should come from the app developer portal.

delegate methods

Native Auth V2 (server-driven)

  • Reset the password using the server-driven (V2) flow.

    Warning

    This API is experimental. It may be changed in the future without notice. Do not use in production applications.

    Declaration

    Swift

    public func resetPasswordV2(
        parameters: MSALNativeAuthResetPasswordParameters,
        delegate: MSALNativeAuthFlowDelegate
    )

    Parameters

    parameters

    Parameters used for the Reset Password flow.

    delegate

    Unified delegate that receives callbacks for the flow.

  • Retrieve the current signed in account from the cache.

    Declaration

    Swift

    public func getNativeAuthUserAccount(correlationId: UUID? = nil) -> MSALNativeAuthUserAccountResult?

    Parameters

    correlationId

    Optional. UUID to correlate this request with the server for debugging.

    Return Value

    An object representing the account information if present in the local cache.