User Auth

This module handles user authentication and authorization.

Methods

(async, inner) auth(req, res) → {Promise.<(Object|Error)>}

Authenticates the user based on the provided token or authorization header.

Parameters:
NameTypeDescription
reqObject

The request object.

Properties
NameTypeAttributesDescription
headers.authorizationstring<optional>

The authorization header.

params.tokenstring<optional>

The token provided as a query parameter.

cookiesObject<optional>

The cookies object.

cookies[process.env.TITLE]string<optional>

The cookie containing the token.

resObject

The response object.

Returns:

A Promise that resolves with the user object or an Error if authentication fails.

Type: 
Promise.<(Object|Error)>