Skip to content

Vonage Network Auth

github-actions edited this page Dec 10, 2024 · 29 revisions

Vonage Network Auth


Documentation / Vonage Network Auth

Vonage Network Auth

Enumerations

Purpose

Netowrk API purposes for generating the scope

Enumeration Members

Enumeration Member Value Description Defined in
FRAUD_PREVENTION_AND_DETECTION "FraudPreventionAndDetection" Purpose for Fraud Prevention and Detection packages/network-client/lib/enums/purpose.ts:8

Scope

Scopes for the API

Enumeration Members

Enumeration Member Value Description Defined in
CHECK_SIM_SWAP "check-sim-swap" Check for SIM Swap packages/network-client/lib/enums/scope.ts:8
NUMBER_VERIFICATION_VERIFY_READ "number-verification-verify-read" Number Verification packages/network-client/lib/enums/scope.ts:13

Classes

InvalidPurposeError

Error thrown when purpose is invalid

Extends

  • Error

Constructors

new InvalidPurposeError()
new InvalidPurposeError(): InvalidPurposeError
Returns

InvalidPurposeError

Overrides

Error.constructor

Defined in

packages/network-client/lib/errors/invalidPurposeError.ts:5

Properties

cause?
optional cause: unknown;
Inherited from

Error.cause

Defined in

node_modules/typescript/lib/lib.es2022.error.d.ts:24

message
message: string;
Inherited from

Error.message

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1077

name
name: string;
Inherited from

Error.name

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1076

stack?
optional stack: string;
Inherited from

Error.stack

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1078

prepareStackTrace()?
static optional prepareStackTrace: (err, stackTraces) => any;

Optional override for formatting stack traces

Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace

Defined in

node_modules/@types/node/globals.d.ts:143

stackTraceLimit
static stackTraceLimit: number;
Inherited from

Error.stackTraceLimit

Defined in

node_modules/@types/node/globals.d.ts:145

Methods

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void

Create .stack property on a target object

Parameters
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

Error.captureStackTrace

Defined in

node_modules/@types/node/globals.d.ts:136


InvalidScopeError

Error thrown when scope is invalid

Extends

  • Error

Constructors

new InvalidScopeError()
new InvalidScopeError(): InvalidScopeError
Returns

InvalidScopeError

Overrides

Error.constructor

Defined in

packages/network-client/lib/errors/invalidScopeError.ts:5

Properties

cause?
optional cause: unknown;
Inherited from

Error.cause

Defined in

node_modules/typescript/lib/lib.es2022.error.d.ts:24

message
message: string;
Inherited from

Error.message

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1077

name
name: string;
Inherited from

Error.name

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1076

stack?
optional stack: string;
Inherited from

Error.stack

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1078

prepareStackTrace()?
static optional prepareStackTrace: (err, stackTraces) => any;

Optional override for formatting stack traces

Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace

Defined in

node_modules/@types/node/globals.d.ts:143

stackTraceLimit
static stackTraceLimit: number;
Inherited from

Error.stackTraceLimit

Defined in

node_modules/@types/node/globals.d.ts:145

Methods

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void

Create .stack property on a target object

Parameters
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

Error.captureStackTrace

Defined in

node_modules/@types/node/globals.d.ts:136


MissingPurposeError

Error thrown when purpose is invalid

Extends

  • Error

Constructors

new MissingPurposeError()
new MissingPurposeError(): MissingPurposeError
Returns

MissingPurposeError

Overrides

Error.constructor

Defined in

packages/network-client/lib/errors/missingPurposeError.ts:5

Properties

cause?
optional cause: unknown;
Inherited from

Error.cause

Defined in

node_modules/typescript/lib/lib.es2022.error.d.ts:24

message
message: string;
Inherited from

Error.message

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1077

name
name: string;
Inherited from

Error.name

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1076

stack?
optional stack: string;
Inherited from

Error.stack

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1078

prepareStackTrace()?
static optional prepareStackTrace: (err, stackTraces) => any;

Optional override for formatting stack traces

Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace

Defined in

node_modules/@types/node/globals.d.ts:143

stackTraceLimit
static stackTraceLimit: number;
Inherited from

Error.stackTraceLimit

Defined in

node_modules/@types/node/globals.d.ts:145

Methods

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void

Create .stack property on a target object

Parameters
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

Error.captureStackTrace

Defined in

node_modules/@types/node/globals.d.ts:136


MissingScopeError

Error thrown when no scope is set for a request.

Extends

  • Error

Constructors

new MissingScopeError()
new MissingScopeError(): MissingScopeError
Returns

MissingScopeError

Overrides

Error.constructor

Defined in

packages/network-client/lib/errors/missingScopeError.ts:5

Properties

cause?
optional cause: unknown;
Inherited from

Error.cause

Defined in

node_modules/typescript/lib/lib.es2022.error.d.ts:24

message
message: string;
Inherited from

Error.message

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1077

name
name: string;
Inherited from

Error.name

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1076

stack?
optional stack: string;
Inherited from

Error.stack

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1078

prepareStackTrace()?
static optional prepareStackTrace: (err, stackTraces) => any;

Optional override for formatting stack traces

Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace

Defined in

node_modules/@types/node/globals.d.ts:143

stackTraceLimit
static stackTraceLimit: number;
Inherited from

Error.stackTraceLimit

Defined in

node_modules/@types/node/globals.d.ts:145

Methods

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void

Create .stack property on a target object

Parameters
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

Error.captureStackTrace

Defined in

node_modules/@types/node/globals.d.ts:136


NetworkClient

Extends

Extended by

Constructors

new NetworkClient()
new NetworkClient(auth, config?): NetworkClient
Parameters
auth

NetworkAuthParameters

config?

NetworkConfigParameters

Returns

NetworkClient

Overrides

Client.constructor

Defined in

packages/network-client/lib/networkClient.ts:62

Properties

_msisdn
protected _msisdn: string;

The msisdn that will be used for API calls

Defined in

packages/network-client/lib/networkClient.ts:45

_purpose?
protected optional _purpose: Purpose;

The purpose for the scope

Defined in

packages/network-client/lib/networkClient.ts:50

_scope?
protected optional _scope: Scope;

The scope for the token

Defined in

packages/network-client/lib/networkClient.ts:55

accessToken?
protected optional accessToken: string;

The current token

Defined in

packages/network-client/lib/networkClient.ts:35

auth
protected auth: AuthInterface;

The authentication instance responsible for generating authentication headers and query parameters.

Inherited from

Client.auth

Defined in

packages/server-client/dist/lib/client.d.ts:24

authType?
protected optional authType: AuthenticationType;

The type of authentication used for the client's requests.

Inherited from

Client.authType

Defined in

packages/server-client/dist/lib/client.d.ts:20

config
protected config: NetworkConfigParameters;

Configuration settings for the client, including default hosts for various services and other request settings.

Overrides

Client.config

Defined in

packages/network-client/lib/networkClient.ts:60

expires
protected expires: number = 0;

Timestamp until the token expires

Defined in

packages/network-client/lib/networkClient.ts:40

gettingToken
protected gettingToken: boolean = false;

Flags if we are currently getting a token

Defined in

packages/network-client/lib/networkClient.ts:30

transformers
static transformers: object;

Static property containing utility transformers.

camelCaseObjectKeys
camelCaseObjectKeys: PartialTransformFunction;
kebabCaseObjectKeys
kebabCaseObjectKeys: PartialTransformFunction;
omit()
omit: (keys, obj) => TransformedObject;
Parameters
keys

string[]

obj

ObjectToTransform

Returns

TransformedObject

snakeCaseObjectKeys
snakeCaseObjectKeys: PartialTransformFunction;
Inherited from

Client.transformers

Defined in

packages/server-client/dist/lib/client.d.ts:11

Accessors

msisdn
Get Signature
get msisdn(): string

Get the msisdn

Throws

If the msisdn is not set

Returns

string

The msisdn

Defined in

packages/network-client/lib/networkClient.ts:81

purpose
Get Signature
get purpose(): Purpose

Get the purpose

Throws

If the purpose is not set

Throws

If the purpose is not valid

Returns

Purpose

The purpose

Set Signature
set purpose(value): void

Set the purpose

Parameters
value

Purpose

The purpose

Returns

void

Defined in

packages/network-client/lib/networkClient.ts:96

scope
Get Signature
get scope(): Scope

Get the scope

Throws

If the scope is not set

Throws

If the scope is not valid

Returns

Scope

The scope

Set Signature
set scope(value): void

Set the scope

Throws

If the scope is not valid

Throws

If the scope is not set

Parameters
value

Scope

The scope

Returns

void

Defined in

packages/network-client/lib/networkClient.ts:123

Methods

addAuthenticationToRequest()
addAuthenticationToRequest(request): Promise<VetchOptions>

Add authentication to the auth

This will make the calls to get a network token if required.

Parameters
request

VetchOptions

The request to add authentication to

Returns

Promise<VetchOptions>

The request with authentication added

Overrides

Client.addAuthenticationToRequest

Defined in

packages/network-client/lib/networkClient.ts:154

addBasicAuthToRequest()
protected addBasicAuthToRequest(request): Promise<VetchOptions>

Adds basic authentication headers to the request.

Parameters
request

VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addBasicAuthToRequest

Defined in

packages/server-client/dist/lib/client.d.ts:71

addJWTToRequest()
protected addJWTToRequest(request): Promise<VetchOptions>

Adds a JWT to the request.

Parameters
request

VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addJWTToRequest

Defined in

packages/server-client/dist/lib/client.d.ts:64

addQueryKeySecretToRequest()
protected addQueryKeySecretToRequest(request): Promise<VetchOptions>

Adds API key and secret to the request.

Parameters
request

VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addQueryKeySecretToRequest

Defined in

packages/server-client/dist/lib/client.d.ts:57

addQueryKeySecretToRequestBody()
protected addQueryKeySecretToRequestBody(request): Promise<VetchOptions>

Adds API key and secret to the request body.

Parameters
request

VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addQueryKeySecretToRequestBody

Defined in

packages/server-client/dist/lib/client.d.ts:50

buildOIDCURL()
buildOIDCURL(state): string

Build the URL for the OIDC flow

Parameters
state

string = ''

The state to use

Returns

string

The URL for the OIDC flow

Defined in

packages/network-client/lib/networkClient.ts:191

exchangeCodeForToken()
exchangeCodeForToken(code): Promise<NetworkTokenResponse>

Exchange the code for a network token

Parameters
code

string

The code to exchange

Returns

Promise<NetworkTokenResponse>

The network token token

Defined in

packages/network-client/lib/networkClient.ts:224

getCIBAAccessToken()
protected getCIBAAccessToken(cibaRequestId): Promise<NetworkTokenResponse>

Get a network token

Parameters
cibaRequestId

string

The CIBA request id

Returns

Promise<NetworkTokenResponse>

The network token data

Defined in

packages/network-client/lib/networkClient.ts:306

getCIBARequestId()
protected getCIBARequestId(): Promise<string>

Get an CIBA request id

Returns

Promise<string>

The CIBA request id

Defined in

packages/network-client/lib/networkClient.ts:355

getCIBAToken()
protected getCIBAToken(): Promise<void>

Get the access token for the CIBA flow

This is a two step process. First we need to get an CIBA request id, then we can use that to get a network token.

Returns

Promise<void>

Defined in

packages/network-client/lib/networkClient.ts:283

getConfig()
getConfig(): ConfigParams
Returns

ConfigParams

Inherited from

Client.getConfig

Defined in

packages/server-client/dist/lib/client.d.ts:36

parseResponse()
protected parseResponse<T>(request, response): Promise<VetchResponse<T>>

Parses the response based on its content type.

Type Parameters

T

The expected type of the parsed response data.

Parameters
request

VetchOptions

The request options.

response

Response

The raw response from the request.

Returns

Promise<VetchResponse<T>>

  • The parsed response.
Inherited from

Client.parseResponse

Defined in

packages/server-client/dist/lib/client.d.ts:168

prepareBody()
protected prepareBody(request): undefined | string

Prepares the body for the request based on the content type.

Parameters
request

VetchOptions

The request options.

Returns

undefined | string

  • The prepared request body as a string or undefined.
Inherited from

Client.prepareBody

Defined in

packages/server-client/dist/lib/client.d.ts:158

prepareRequest()
protected prepareRequest(request): Promise<VetchOptions>

Prepares the request with necessary headers, authentication, and query parameters.

Parameters
request

VetchOptions

The initial request options.

Returns

Promise<VetchOptions>

  • The modified request options.
Inherited from

Client.prepareRequest

Defined in

packages/server-client/dist/lib/client.d.ts:151

sendDeleteRequest()
sendDeleteRequest<T>(url): Promise<VetchResponse<T>>

Sends a DELETE request to the specified URL.

Type Parameters

T

Parameters
url

string

The URL endpoint for the DELETE request.

Returns

Promise<VetchResponse<T>>

  • The response from the DELETE request.
Inherited from

Client.sendDeleteRequest

Defined in

packages/server-client/dist/lib/client.d.ts:78

sendFormSubmitRequest()
sendFormSubmitRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a POST request with form data to the specified URL.

Type Parameters

T

Parameters
url

string

The URL endpoint for the POST request.

payload?

Record<string, undefined | string>

Optional payload containing form data to send with the POST request.

Returns

Promise<VetchResponse<T>>

  • The response from the POST request.
Inherited from

Client.sendFormSubmitRequest

Defined in

packages/server-client/dist/lib/client.d.ts:86

sendGetRequest()
sendGetRequest<T>(url, queryParams?): Promise<VetchResponse<T>>

Sends a GET request to the specified URL with optional query parameters.

Type Parameters

T

Parameters
url

string

The URL endpoint for the GET request.

queryParams?

Optional query parameters to append to the URL. These should be compatible with Node's URLSearchParams.

Returns

Promise<VetchResponse<T>>

  • The response from the GET request.
Inherited from

Client.sendGetRequest

Defined in

packages/server-client/dist/lib/client.d.ts:94

sendPatchRequest()
sendPatchRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a PATCH request to the specified URL with an optional payload.

Type Parameters

T

Parameters
url

string

The URL endpoint for the PATCH request.

payload?

Optional payload to be sent as the body of the PATCH request.

Returns

Promise<VetchResponse<T>>

  • The response from the PATCH request.
Inherited from

Client.sendPatchRequest

Defined in

packages/server-client/dist/lib/client.d.ts:104

sendPostRequest()
sendPostRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a POST request to the specified URL with an optional payload.

Type Parameters

T

Parameters
url

string

The URL endpoint for the POST request.

payload?

Optional payload to be sent as the body of the POST request.

Returns

Promise<VetchResponse<T>>

  • The response from the POST request.
Inherited from

Client.sendPostRequest

Defined in

packages/server-client/dist/lib/client.d.ts:114

sendPutRequest()
sendPutRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a PUT request to the specified URL with an optional payload.

Type Parameters

T

Parameters
url

string

The URL endpoint for the PUT request.

payload?

Optional payload to be sent as the body of the PUT request.

Returns

Promise<VetchResponse<T>>

  • The response from the PUT request.
Inherited from

Client.sendPutRequest

Defined in

packages/server-client/dist/lib/client.d.ts:124

sendRequest()
sendRequest<T>(request): Promise<VetchResponse<T>>

Sends a request adding necessary headers, handling authentication, and parsing the response.

Type Parameters

T

Parameters
request

VetchOptions

The options defining the request, including URL, method, headers, and data.

Returns

Promise<VetchResponse<T>>

  • The parsed response from the request.
Inherited from

Client.sendRequest

Defined in

packages/server-client/dist/lib/client.d.ts:144

sendRequestWithData()
sendRequestWithData<T>(
   method, 
   url, 
payload?): Promise<VetchResponse<T>>

Sends a request with JSON-encoded data to the specified URL using the provided HTTP method.

Type Parameters

T

Parameters
method

The HTTP method to be used for the request (only POST, PATCH, or PUT are acceptable).

POST | PUT | PATCH

url

string

The URL endpoint for the request.

payload?

Optional payload to be sent as the body of the request, JSON-encoded.

Returns

Promise<VetchResponse<T>>

  • The response from the request.
Inherited from

Client.sendRequestWithData

Defined in

packages/server-client/dist/lib/client.d.ts:135

Type Aliases

CIBAResponse

type CIBAResponse: object;

Type declaration

auth_req_id
auth_req_id: string;

CIBA ODIC token

expires_in
expires_in: number;

Seconds until the token expires

interval?
optional interval: string;

This is the minimum polling interval in seconds

Defined in

packages/network-client/lib/types/responses/odicResponse.ts:1


NetworkAuthParameters

type NetworkAuthParameters: AuthParams & object;

Type declaration

accessToken?
optional accessToken: string;

The access token to use for API calls

expiresIn?
optional expiresIn: number;

The expiration time of the access token (in seconds)

msisdn
msisdn: string;

The msisdn that will be used for API calls

Defined in

packages/network-client/lib/types/parameters/networkAuthParameters.ts:3


NetworkConfigParameters

type NetworkConfigParameters: ConfigParams & object;

Type declaration

networkApiHost?
optional networkApiHost: string;

URL for making calls to get a network token

odicHost?
optional odicHost: string;

URL for making calls to get a network token

redirectUri?
optional redirectUri: string;

The URL to redirect to for the OAuth flow

Defined in

packages/network-client/lib/types/parameters/networkConfigParameters.ts:3


NetworkTokenResponse

type NetworkTokenResponse: object;

Type declaration

access_token
access_token: string;

The token

expires_in
expires_in: number;

The time in seconds from now that the token expires

token_type
token_type: "Bearer";

The type of token

Defined in

packages/network-client/lib/types/responses/networkTokenResponse.ts:1

Clone this wiki locally