initialize: (
initializeParams
) =>void
Initializes the SDK with the provided parameters. Despite the SDK can be used
without calling this function beforehand, in stateful environments like in a
single page application running in a browser, it is recommended. This is true
because the initialize
function accepts some parameters that in case of not
being passed to it, they would have to be passed in every function call made
to the SDK.
In order to easier call functions afterwards, this function has to be called
before using any other SDK functions, and as the bare minimum, it requires an
access token.
It’s useful to rely on the exposed SDK constants to pass some of the parameters.
An object with the parameters to initialize the SDK.
The only required parameter is the accessToken
.
accessToken
: The access token to authenticate the user. This has to be previously
generated using the OAuth authentication flow.environment
: Optional parameter to set the SDK’s environment. If not provided,
the SDK will default to ENVIRONMENTS.PRODUCTION
. Use ENVIRONMENTS.STAGING
to set
the SDK to staging.branch
: Optional parameter to set the SDK’s branch. This is only relevant when the
environment
is set to ENVIRONMENTS.STAGING
. The possible values are BRANCHES.MASTER
,
BRANCHES.SANDBOX
and BRANCHES.QA
. If not provided, the SDK will default to
BRANCHES.MASTER
.operationSettings
: Optional settings to configure the SDK’s operations that will
be performed after the initialization. This can be also provided when calling the
operation functions themselves.uiParentElementId
: The id of the DOM element where the SDK will be rendered.mfaPreference
: The MFA preference to use for the operations. This can be either
MFA_METHODS.PASSKEY
, MFA_METHODS.PAIRED_DEVICE
or MFA_METHODS.SMS_OTP
. If not
provided, the SDK will default to MFA_METHODS.PASSKEY
.locale
: Optional 2 digit language code to set the language in which the UI elements
injected by the SDK will show the text.void
InvalidParametersError
If the access token is not provided or the specified
parameters don’t comply with the expected format.
initialize: (
initializeParams
) =>void
Initializes the SDK with the provided parameters. Despite the SDK can be used
without calling this function beforehand, in stateful environments like in a
single page application running in a browser, it is recommended. This is true
because the initialize
function accepts some parameters that in case of not
being passed to it, they would have to be passed in every function call made
to the SDK.
In order to easier call functions afterwards, this function has to be called
before using any other SDK functions, and as the bare minimum, it requires an
access token.
It’s useful to rely on the exposed SDK constants to pass some of the parameters.
An object with the parameters to initialize the SDK.
The only required parameter is the accessToken
.
accessToken
: The access token to authenticate the user. This has to be previously
generated using the OAuth authentication flow.environment
: Optional parameter to set the SDK’s environment. If not provided,
the SDK will default to ENVIRONMENTS.PRODUCTION
. Use ENVIRONMENTS.STAGING
to set
the SDK to staging.branch
: Optional parameter to set the SDK’s branch. This is only relevant when the
environment
is set to ENVIRONMENTS.STAGING
. The possible values are BRANCHES.MASTER
,
BRANCHES.SANDBOX
and BRANCHES.QA
. If not provided, the SDK will default to
BRANCHES.MASTER
.operationSettings
: Optional settings to configure the SDK’s operations that will
be performed after the initialization. This can be also provided when calling the
operation functions themselves.uiParentElementId
: The id of the DOM element where the SDK will be rendered.mfaPreference
: The MFA preference to use for the operations. This can be either
MFA_METHODS.PASSKEY
, MFA_METHODS.PAIRED_DEVICE
or MFA_METHODS.SMS_OTP
. If not
provided, the SDK will default to MFA_METHODS.PASSKEY
.locale
: Optional 2 digit language code to set the language in which the UI elements
injected by the SDK will show the text.void
InvalidParametersError
If the access token is not provided or the specified
parameters don’t comply with the expected format.