AuthenticationState

public enum AuthenticationState : Equatable

A value representing an authentication state.

After a successful authentication, the authentication always goes into the AuthenticationState.authenticated(token:, user:) state.

After using the Authentication.logOut() method, the authentication always goes into the AuthenticationState.unauthenticated(reason:) state.

Cases

  • Describes the unauthenticated state.

    There are several reasons for the process to be in the notAuthenticated state (e.g. failed to connect, waiting for one-time password). These reasons are described in the AuthenticationState.Reason object.

    Indicates that there is currently no authentication token..

    From this state, a successful authentication brings the .authenticated(user:) state.

    Declaration

    Swift

    case unauthenticated(reason: UnauthenticatedReason)

    Parameters

    reason

    The reason why the authentication process is in the unauthenticated state.

  • Indicates that there is a valid authentication token.

    The associated value contains information about the authenticated user.

    From this state:

    Declaration

    Swift

    case authenticated(token: String, user: User)

    Parameters

    token

    The token associated to the authentication

    user

    The user authenticated

  • Indicates that the authentication is in progress.

    Declaration

    Swift

    case authenticationInProgress(msisdn: String, progress: AuthenticatingStateProgress)
  • Declaration

    Swift

    public var authenticatedUser: User? { get }
  • Declaration

    Swift

    public var authenticationToken: String? { get }