Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Login

The userLogin method is used to authenticate a user with a username and password.

public func userLogin(userName: String, 
                      password: String, 
                      success: @escaping() -> Void, 
                      failure: @escaping (Error) -> Void)

Parameter

Type

Description

userName

String

The user’s username.

password

String

The user’s password.

success

Closure

A closure called when the authentication is successful.

failure

Closure

A closure called when the authentication fails, with the error parameter.

Example Usage

AuthenticateService.shared.userLogin(userName: username, password: password, success: { 
    // Authentication successful
    // Perform any actions or navigate to the next screen
}, failure: { error in
    // Authentication failed
    // Handle the error or display an error message
})

Guest Login

The userLogin method is used to authenticate a user with a username and password.

public func guestLogin(_ firstName: String, 
                          lastName: String, 
                          success: @escaping() -> Void, 
                          failure: @escaping (Error) -> Void)

Parameter

Type

Description

firstName

String

The guest’s first name.

lastName

String

The guest’s last name.

success

Closure

A closure called when the authentication is successful.

failure

Closure

A closure called when the authentication fails, with the error parameter.

Example Usage

AuthenticateService.shared.userLogin(firstName, lastName: lastName, success: {
        // Guest login successful
    // Perform any actions or navigate to the next screen
}, failure: { error in
    // Guest login failed
    // Handle the error or display an error message
})

Login By Token (SSO)

The loginBySSOToken method is used to authenticate a user using a single sign-on (SSO) token.

public func loginBySSOToken(_ token: String, 
                            success: @escaping() -> Void, 
                            failure: @escaping (Error) -> Void)

Parameter

Type

Description

token

String

The single sign-on token.

success

Closure

A closure called when the authentication is successful.

failure

Closure

A closure called when the authentication fails, with the error parameter.

Example Usage

// Perform authentication using the provided SSO token
AuthenticateService.shared.loginBySSOToken(ssoToken, success: { 
    // Authentication successful
    // Perform any actions or navigate to the next screen
}, failure: { error in
    // Authentication failed
    // Handle the error or display an error message
})

Logout

The logoutVC method is used to log out of the VSee Clinic session.

public func logoutVC(success: @escaping() -> Void, 
                    failure: @escaping (Error) -> Void)

Parameter

Type

Description

success

Closure

A closure called when the logout is successful.

failure

Closure

A closure called when the logout fails, with the error parameter.

Example Usage

AuthenticateService.shared.logoutVC(success: {
    // Logout successful
    // Perform actions after successful logout
}) { error in
    // Logout failed
    // Handle the error or display an error message
}

Restore Logged in Session

The restoreLoginSession method is used to restore a login session.

public func restoreLoginSession(success: @escaping() -> Void, 
                                failure: @escaping (Error) -> Void)

Parameter

Type

Description

success

Closure

A closure called when the login session is successfully restored.

failure

Closure

A closure called when restoring the login session fails, with the error parameter.

Example Usage

// Restore the login session for the previously logged-in user
AuthenticateService.shared.restoreLoginSession(success: {
    // Login session restored successfully
    // Perform any necessary actions or navigate to the next screen
}, failure: { error in
    // Failed to restore the login session
    // Handle the error or display an error message
})

  • No labels