Class: Authentication

Authentication(config)

Allows you to manage your Authentication module in WHMCS.

Constructor

new Authentication(config)

Parameters:
Name Type Description
config Object Object containing your API credentials.
Properties
Name Type Attributes Description
serverUrl string URL to your installation. Remember to point to /includes/api.php
username string <optional>
password string <optional>
identifier string <optional>
secret string <optional>
Source:

Extends

  • WHMCS

Methods

createOAuthCredential(opts)

Create an OAuth Credential - https://developers.whmcs.com/api-reference/createoauthcredential/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
grantType String One of ‘authorization_code’ or ‘single_sign_on’
scope String A space separated list of valid scopes from tbloauthserver_scopes
name String <optional>
The name to give the oAuth Credential for the authorization_code $grantType
serviceId Number <optional>
The id of the service for the single_sign_on $grantType
description String <optional>
The description of the OAuth Credential
logoUri String <optional>
URL or Path Relative to the Base WHMCS Client Area Directory to a logo image file for this application.
redirectUri String <optional>
Authorised Redirect URIs
Source:

deleteOAuthCredential(opts)

Removes OAuth Credential record. This action cannot be undone. - https://developers.whmcs.com/api-reference/deleteoauthcredential/
Parameters:
Name Type Description
opts Object
Properties
Name Type Description
credentialId Number The credential id to be deleted
Source:

listOAuthCredentials(opts)

List OAuth Credentials matching passed criteria - https://developers.whmcs.com/api-reference/listoauthcredentials/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
grantType String <optional>
Find credentials for a specific grant type
sortField String <optional>
Sort the response using the passed field
sortOrder String <optional>
The direction of the sort order (‘ASC’, ‘DESC’)
limit Number <optional>
To limit the number of returned credentials
Source:

updateOAuthCredential(opts)

Updates a given OAuth API Client Credential. - https://developers.whmcs.com/api-reference/updateoauthcredential/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
credentialId Number The auto increment ID of the credential set to be updated
clientApiIdentifier String <optional>
The OAuth API Client Credential Unique Identifier (Client ID) to be updated. Only required if credentialId is not known/passed.
name String <optional>
The name to assign
description String <optional>
The description to assign
grantType String <optional>
The grant type for which the credential set is valid for. Possible values include: authorization_code or single_sign_on
scope String <optional>
A space delimited list of the scopes for which the credential set is valid. See CreateOAuthCredential for permitted values
serviceId Number <optional>
The service ID for which the credential relates to
logoUri Array.<String> <optional>
he logoUri to assign
redirectUri String <optional>
An array of Authorized Redirect URIs
resetSecret Boolean <optional>
Set to true to reset the OAuth API Client Credential Secret
Source:

validateLogin(opts)

This command can be used to validate an email address and password against a registered user in WHMCS. On success, the userid and password hash will be returned which can be used to create an authenticated session by setting the session key ‘uid’ to the userid and the session key ‘upw’ to the passwordhash. Note: if session IP validation is enabled, this API call must be executed via the local API to receive a valid hash. - https://developers.whmcs.com/api-reference/validatelogin/
Parameters:
Name Type Description
opts Object
Properties
Name Type Description
email String Client or Sub-Account Email Address
password2 String Password to validate
Source: