Skip to main content

Function: getRequestData()

getRequestData(req, headerKey?, headerScheme?): object

Defined in: src/auth/shared.ts:84

Attempts to decode the request for authentication request data. The auth request data may be in a header, a query parameter or the request body itself. It may either be JSON encoded or form-data encoded. We want to return a regular object.

Parameters

req

HttpRequest

The request to return auth request data for.

headerKey?

string | undefined

The name of a header to look for request data in. Set to an empty string to skip the header search entirely — passing undefined has no effect, since that just triggers the default value. Default is 'Authorization'.

headerScheme?

string = "basic"

The header scheme to look for. Default is 'basic'.

Returns

object

The found request data and its decoded payload object.

data

data: any

payload

payload: any