MimiAuthController
public protocol MimiAuthController : MimiCoreController
Controller which provides access to Mimi account authentication.
MimiAuthController is the focal point for all authentication related logic,
providing access to the current authentication status, and the functions required
for modifying the auth status. All authentication context should be provided from here.
-
Observable for the auth controller.
Declaration
Swift
var observable: MimiCoreObservable<MimiAuthControllerObservable> { get } -
The currently authenticated user.
Declaration
Swift
var currentUser: MimiUser? { get } -
Authenticate a user.
Warning
When using the
deviceAuthorizationrouteyou should always handle theMimiAuthTokenRequestobject that is returned from this function. AsdeviceAuthorizationwill continuously poll for authentication until expiry, you are responsible for cancelling the request if it is no longer required.Declaration
Swift
@discardableResult func authenticate(route: MimiAuthRoute, result: MimiCoreResultHandler<MimiUser>) -> MimiAuthTokenRequest?Parameters
routeThe route of authentication to use.
resultResult of the authentication request.
Return Value
Request for the token that can be cancelled (only available when polling required).
-
Reset the password of a user.
- email: The email of the user
Declaration
Swift
func resetPassword(email: String, result: MimiCoreResultHandler<Void>) -
Request remote authorization for the current device.
Declaration
Swift
func requestDeviceAuthorization(result: MimiCoreResultHandler<MimiDeviceAuthRequest>)Parameters
resultResult of the request.
-
Approve an authorization request for a remote device.
Declaration
Swift
func approveDeviceAuthorization(request: MimiDeviceAuthRequest, result: MimiCoreResultHandler<Void>)Parameters
requestAuthorization request to approve.
resultResult of the approval request.
-
Log out the current user.
Declaration
Swift
func logOut() -
Reload the current user.
Declaration
Swift
func reloadUser(result: MimiCoreResultHandler<MimiUser>)Parameters
resultResult of the user reload.
-
Asynchronously loads the URL of the user account portal.
This function retrieves the URL for the user account portal, allowing users to access their account information.
Throws
An error if the loading process encounters any issues.Declaration
Swift
func loadUserAccountPortalURL() async throws -> URLReturn Value
An asynchronous task that returns a
URLrepresenting the user account portal URL.
MimiAuthController Protocol Reference