Module

services/auth

This template service is designed to handle the authentication flow.

It provides two login functions, a logout and other helpful functions: loginByCredentials: Regular username/passworkd loginByPairingCode: Associate a code with an user logout: Logout the current logged in user validateUser: Validate an user based on a token pairingCode: Retrieves a code to be shown on a device Keep in mind this service is used by AuthContext Context API.

Methods

# async inner forgotPassword(username) → {Promise.<String>}

Forgot Password Service.

Parameters:
Name Type Description
username String

Username

Password restore

Promise.<String>

# async inner getPairingCode(deviceId) → {Promise.<String>}

Pairing Code Service.

Parameters:
Name Type Description
deviceId String

Device to pair

Pairing code

Promise.<String>

# async inner getUser() → {Promise.<User>}

Gets the current user info

A Promise with the User returned

Promise.<User>

# async inner loginByCredentials(username, password) → {Promise.<User>}

Credentials Login Service.

Parameters:
Name Type Description
username String

Username

password String

Password

Loggedin User

Promise.<User>

# async inner loginByPairingCode(deviceId, abortControlleropt) → {Promise.<void>}

Pairing Code Login Service.

Parameters:
Name Type Attributes Default Description
deviceId String

Device to pair

abortController AbortController <optional>
null

Controller to abort a request if needed

Void

Promise.<void>

# async inner logout() → {Promise.<Boolean>}

Logout Service.

Logout success

Promise.<Boolean>

# async inner validateUser() → {Promise.<User>|null}

Validate User Service.

Loggedin User

Promise.<User> | null