-
Notifications
You must be signed in to change notification settings - Fork 181
Vonage Network Auth
Vonage Network Auth • Docs
Documentation / Vonage Network Auth
Netowrk API purposes for generating the scope
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 |
Scopes for the API
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 |
Error thrown when purpose is invalid
Error
new InvalidPurposeError(): InvalidPurposeError
Error.constructor
packages/network-client/lib/errors/invalidPurposeError.ts:5
optional cause: unknown;
Error.cause
node_modules/typescript/lib/lib.es2022.error.d.ts:24
message: string;
Error.message
node_modules/typescript/lib/lib.es5.d.ts:1077
name: string;
Error.name
node_modules/typescript/lib/lib.es5.d.ts:1076
optional stack: string;
Error.stack
node_modules/typescript/lib/lib.es5.d.ts:1078
static optional prepareStackTrace: (err, stackTraces) => any;
Optional override for formatting stack traces
• err: Error
• stackTraces: CallSite
[]
any
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Error.prepareStackTrace
node_modules/@types/node/globals.d.ts:143
static stackTraceLimit: number;
Error.stackTraceLimit
node_modules/@types/node/globals.d.ts:145
static captureStackTrace(targetObject, constructorOpt?): void
Create .stack property on a target object
• targetObject: object
• constructorOpt?: Function
void
Error.captureStackTrace
node_modules/@types/node/globals.d.ts:136
Error thrown when scope is invalid
Error
new InvalidScopeError(): InvalidScopeError
Error.constructor
packages/network-client/lib/errors/invalidScopeError.ts:5
optional cause: unknown;
Error.cause
node_modules/typescript/lib/lib.es2022.error.d.ts:24
message: string;
Error.message
node_modules/typescript/lib/lib.es5.d.ts:1077
name: string;
Error.name
node_modules/typescript/lib/lib.es5.d.ts:1076
optional stack: string;
Error.stack
node_modules/typescript/lib/lib.es5.d.ts:1078
static optional prepareStackTrace: (err, stackTraces) => any;
Optional override for formatting stack traces
• err: Error
• stackTraces: CallSite
[]
any
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Error.prepareStackTrace
node_modules/@types/node/globals.d.ts:143
static stackTraceLimit: number;
Error.stackTraceLimit
node_modules/@types/node/globals.d.ts:145
static captureStackTrace(targetObject, constructorOpt?): void
Create .stack property on a target object
• targetObject: object
• constructorOpt?: Function
void
Error.captureStackTrace
node_modules/@types/node/globals.d.ts:136
Error thrown when purpose is invalid
Error
new MissingPurposeError(): MissingPurposeError
Error.constructor
packages/network-client/lib/errors/missingPurposeError.ts:5
optional cause: unknown;
Error.cause
node_modules/typescript/lib/lib.es2022.error.d.ts:24
message: string;
Error.message
node_modules/typescript/lib/lib.es5.d.ts:1077
name: string;
Error.name
node_modules/typescript/lib/lib.es5.d.ts:1076
optional stack: string;
Error.stack
node_modules/typescript/lib/lib.es5.d.ts:1078
static optional prepareStackTrace: (err, stackTraces) => any;
Optional override for formatting stack traces
• err: Error
• stackTraces: CallSite
[]
any
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Error.prepareStackTrace
node_modules/@types/node/globals.d.ts:143
static stackTraceLimit: number;
Error.stackTraceLimit
node_modules/@types/node/globals.d.ts:145
static captureStackTrace(targetObject, constructorOpt?): void
Create .stack property on a target object
• targetObject: object
• constructorOpt?: Function
void
Error.captureStackTrace
node_modules/@types/node/globals.d.ts:136
Error thrown when no scope is set for a request.
Error
new MissingScopeError(): MissingScopeError
Error.constructor
packages/network-client/lib/errors/missingScopeError.ts:5
optional cause: unknown;
Error.cause
node_modules/typescript/lib/lib.es2022.error.d.ts:24
message: string;
Error.message
node_modules/typescript/lib/lib.es5.d.ts:1077
name: string;
Error.name
node_modules/typescript/lib/lib.es5.d.ts:1076
optional stack: string;
Error.stack
node_modules/typescript/lib/lib.es5.d.ts:1078
static optional prepareStackTrace: (err, stackTraces) => any;
Optional override for formatting stack traces
• err: Error
• stackTraces: CallSite
[]
any
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Error.prepareStackTrace
node_modules/@types/node/globals.d.ts:143
static stackTraceLimit: number;
Error.stackTraceLimit
node_modules/@types/node/globals.d.ts:145
static captureStackTrace(targetObject, constructorOpt?): void
Create .stack property on a target object
• targetObject: object
• constructorOpt?: Function
void
Error.captureStackTrace
node_modules/@types/node/globals.d.ts:136
new NetworkClient(auth, config?): NetworkClient
• auth: NetworkAuthParameters
• config?: NetworkConfigParameters
packages/network-client/lib/networkClient.ts:62
protected _msisdn: string;
The msisdn that will be used for API calls
packages/network-client/lib/networkClient.ts:45
protected optional _purpose: Purpose;
The purpose for the scope
packages/network-client/lib/networkClient.ts:50
protected optional _scope: Scope;
The scope for the token
packages/network-client/lib/networkClient.ts:55
protected optional accessToken: string;
The current token
packages/network-client/lib/networkClient.ts:35
protected auth: AuthInterface;
The authentication instance responsible for generating authentication headers and query parameters.
packages/server-client/dist/lib/client.d.ts:24
protected optional authType: AuthenticationType;
The type of authentication used for the client's requests.
packages/server-client/dist/lib/client.d.ts:20
protected config: NetworkConfigParameters;
Configuration settings for the client, including default hosts for various services and other request settings.
packages/network-client/lib/networkClient.ts:60
protected expires: number = 0;
Timestamp until the token expires
packages/network-client/lib/networkClient.ts:40
protected gettingToken: boolean = false;
Flags if we are currently getting a token
packages/network-client/lib/networkClient.ts:30
static transformers: object;
Static property containing utility transformers.
camelCaseObjectKeys: PartialTransformFunction;
kebabCaseObjectKeys: PartialTransformFunction;
omit: (keys, obj) => TransformedObject;
• keys: string
[]
• obj: ObjectToTransform
snakeCaseObjectKeys: PartialTransformFunction;
packages/server-client/dist/lib/client.d.ts:11
get msisdn(): string
Get the msisdn
If the msisdn is not set
string
The msisdn
packages/network-client/lib/networkClient.ts:81
get purpose(): Purpose
Get the purpose
If the purpose is not set
If the purpose is not valid
set purpose(value): void
Set the purpose
• value: Purpose
The purpose
Purpose
The purpose
packages/network-client/lib/networkClient.ts:96
get scope(): Scope
Get the scope
If the scope is not set
If the scope is not valid
set scope(value): void
Set the scope
If the scope is not valid
If the scope is not set
• value: Scope
The scope
The scope
packages/network-client/lib/networkClient.ts:123
addAuthenticationToRequest(request): Promise<VetchOptions>
Add authentication to the auth
This will make the calls to get a network token if required.
• request: VetchOptions
The request to add authentication to
Promise
<VetchOptions
>
The request with authentication added
Client
.addAuthenticationToRequest
packages/network-client/lib/networkClient.ts:154
protected addBasicAuthToRequest(request): Promise<VetchOptions>
Adds basic authentication headers to the request.
• request: VetchOptions
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
packages/server-client/dist/lib/client.d.ts:71
protected addJWTToRequest(request): Promise<VetchOptions>
Adds a JWT to the request.
• request: VetchOptions
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
packages/server-client/dist/lib/client.d.ts:64
protected addQueryKeySecretToRequest(request): Promise<VetchOptions>
Adds API key and secret to the request.
• request: VetchOptions
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
Client
.addQueryKeySecretToRequest
packages/server-client/dist/lib/client.d.ts:57
protected addQueryKeySecretToRequestBody(request): Promise<VetchOptions>
Adds API key and secret to the request body.
• request: VetchOptions
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
Client
.addQueryKeySecretToRequestBody
packages/server-client/dist/lib/client.d.ts:50
buildOIDCURL(state): string
Build the URL for the OIDC flow
• state: string
= ''
The state to use
string
The URL for the OIDC flow
packages/network-client/lib/networkClient.ts:191
exchangeCodeForToken(code): Promise<NetworkTokenResponse>
Exchange the code for a network token
• code: string
The code to exchange
Promise
<NetworkTokenResponse
>
The network token token
packages/network-client/lib/networkClient.ts:224
protected getCIBAAccessToken(cibaRequestId): Promise<NetworkTokenResponse>
Get a network token
• cibaRequestId: string
The CIBA request id
Promise
<NetworkTokenResponse
>
The network token data
packages/network-client/lib/networkClient.ts:306
protected getCIBARequestId(): Promise<string>
Get an CIBA request id
Promise
<string
>
The CIBA request id
packages/network-client/lib/networkClient.ts:355
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.
Promise
<void
>
packages/network-client/lib/networkClient.ts:283
getConfig(): ConfigParams
packages/server-client/dist/lib/client.d.ts:36
protected parseResponse<T>(request, response): Promise<VetchResponse<T>>
Parses the response based on its content type.
• T
The expected type of the parsed response data.
• request: VetchOptions
The request options.
• response: Response
The raw response from the request.
Promise
<VetchResponse
<T
>>
- The parsed response.
packages/server-client/dist/lib/client.d.ts:168
protected prepareBody(request): undefined | string
Prepares the body for the request based on the content type.
• request: VetchOptions
The request options.
undefined
| string
- The prepared request body as a string or undefined.
packages/server-client/dist/lib/client.d.ts:158
protected prepareRequest(request): Promise<VetchOptions>
Prepares the request with necessary headers, authentication, and query parameters.
• request: VetchOptions
The initial request options.
Promise
<VetchOptions
>
- The modified request options.
packages/server-client/dist/lib/client.d.ts:151
sendDeleteRequest<T>(url): Promise<VetchResponse<T>>
Sends a DELETE request to the specified URL.
• T
• url: string
The URL endpoint for the DELETE request.
Promise
<VetchResponse
<T
>>
- The response from the DELETE request.
packages/server-client/dist/lib/client.d.ts:78
sendFormSubmitRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a POST request with form data to the specified URL.
• T
• url: string
The URL endpoint for the POST request.
• payload?: Record
<string
, string
>
Optional payload containing form data to send with the POST request.
Promise
<VetchResponse
<T
>>
- The response from the POST request.
packages/server-client/dist/lib/client.d.ts:86
sendGetRequest<T>(url, queryParams?): Promise<VetchResponse<T>>
Sends a GET request to the specified URL with optional query parameters.
• T
• 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.
Promise
<VetchResponse
<T
>>
- The response from the GET request.
packages/server-client/dist/lib/client.d.ts:94
sendPatchRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a PATCH request to the specified URL with an optional payload.
• T
• url: string
The URL endpoint for the PATCH request.
• payload?
Optional payload to be sent as the body of the PATCH request.
Promise
<VetchResponse
<T
>>
- The response from the PATCH request.
packages/server-client/dist/lib/client.d.ts:104
sendPostRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a POST request to the specified URL with an optional payload.
• T
• url: string
The URL endpoint for the POST request.
• payload?
Optional payload to be sent as the body of the POST request.
Promise
<VetchResponse
<T
>>
- The response from the POST request.
packages/server-client/dist/lib/client.d.ts:114
sendPutRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a PUT request to the specified URL with an optional payload.
• T
• url: string
The URL endpoint for the PUT request.
• payload?
Optional payload to be sent as the body of the PUT request.
Promise
<VetchResponse
<T
>>
- The response from the PUT request.
packages/server-client/dist/lib/client.d.ts:124
sendRequest<T>(request): Promise<VetchResponse<T>>
Sends a request adding necessary headers, handling authentication, and parsing the response.
• T
• request: VetchOptions
The options defining the request, including URL, method, headers, and data.
Promise
<VetchResponse
<T
>>
- The parsed response from the request.
packages/server-client/dist/lib/client.d.ts:144
sendRequestWithData<T>(
method,
url,
payload?): Promise<VetchResponse<T>>
Sends a request with JSON-encoded data to the specified URL using the provided HTTP method.
• T
• method: POST
| PUT
| PATCH
The HTTP method to be used for the request (only POST, PATCH, or PUT are acceptable).
• url: string
The URL endpoint for the request.
• payload?
Optional payload to be sent as the body of the request, JSON-encoded.
Promise
<VetchResponse
<T
>>
- The response from the request.
packages/server-client/dist/lib/client.d.ts:135
type CIBAResponse: object;
auth_req_id: string;
CIBA ODIC token
expires_in: number;
Seconds until the token expires
optional interval: string;
This is the minimum polling interval in seconds
packages/network-client/lib/types/responses/odicResponse.ts:1
type NetworkAuthParameters: AuthParams & object;
optional accessToken: string;
The access token to use for API calls
optional expiresIn: number;
The expiration time of the access token (in seconds)
msisdn: string;
The msisdn that will be used for API calls
packages/network-client/lib/types/parameters/networkAuthParameters.ts:3
type NetworkConfigParameters: ConfigParams & object;
optional networkApiHost: string;
URL for making calls to get a network token
optional odicHost: string;
URL for making calls to get a network token
optional redirectUri: string;
The URL to redirect to for the OAuth flow
packages/network-client/lib/types/parameters/networkConfigParameters.ts:3
type NetworkTokenResponse: object;
access_token: string;
The token
expires_in: number;
The time in seconds from now that the token expires
token_type: "Bearer";
The type of token
packages/network-client/lib/types/responses/networkTokenResponse.ts:1