Makes a type easier to read.
If an object has a parameters
property, and the parameters
object has required properties,
then the parameters
property on the root object is marked as required.
Generic interface for all parameter types.
Wrapper for the authorization endpoint. For federated login (3rd party IDP non-guest), the caller should redirect the user to the url in the url field of the returned object. The url will be the login page for the 3rd party IDP and the user will be sent to the redirectURI on success. Guest sessions return the code and usid directly with no need to redirect.
a configured instance of the ShopperLogin SDK client
random string created by client app to use as a secret in the request
Request parameters used by the authorizeCustomer
endpoint.
the location the client will be returned to after successful login with 3rd party IDP. Must be registered in SLAS.
login url, user id and authorization code if available
A helper function designed to make calls to a custom API endpoint For more information about custom APIs, please refer to the API documentation
Argument object containing data used for custom API request
Raw response or data from response based on rawResponse argument from fetch call
Creates a random string to use as a code verifier. This code is created by the client and sent with both the authorization request (as a code challenge) and the token request.
code verifier
A wrapper function around fetch designed for making requests using the SDK
The url of the resource that you wish to fetch
Raw response or data from response based on rawResponse argument from fetch call
Encodes a code verifier to a code challenge to send to the authorization endpoint
random string to use as a code verifier
code challenge
Parse out the code and usid from a redirect url
A url that contains code
and usid
query parameters, typically returned when calling a Shopper Login endpoint
An object containing the code and usid.
A single function to execute the ShopperLogin Public Client Guest Login with proof key for code exchange flow as described in the API documentation.
a configured instance of the ShopperLogin SDK client.
parameters to pass in the API calls.
Per OAuth standard, a valid app route. Must be listed in your SLAS configuration. On server, this will not be actually called. On browser, this will be called, but ignored.
TokenResponse
A single function to execute the ShopperLogin Private Client Guest Login as described in the API documentation. Note: this func can run on client side. Only use this one when the slas client secret is secured.
a configured instance of the ShopperLogin SDK client
parameters to pass in the API calls.
client secret used for authentication
secret associated with client ID
TokenResponse
A single function to execute the ShopperLogin Public Client Registered User B2C Login with proof key for code exchange flow as described in the API documentation. Note: this func can run on client side. Only use private slas when the slas client secret is secured.
a configured instance of the ShopperLogin SDK client.
the id and password and clientSecret (if applicable) to login with.
the password of the user to login with.
the id of the user to login with.
parameters to pass in the API calls.
Per OAuth standard, a valid app route. Must be listed in your SLAS configuration. On server, this will not be actually called. On browser, this will be called, but ignored.
TokenResponse
Logout a shopper. The shoppers access token and refresh token will be revoked and if the shopper authenticated with ECOM the OCAPI JWT will also be revoked.
a configured instance of the ShopperLogin SDK client.
parameters to pass in the API calls.
a valid access token to exchange for a new access token (and refresh token).
a valid refresh token to exchange for a new access token (and refresh token).
TokenResponse
Adds entropy to nanoid() using seedrandom to ensure that the code_challenge sent to SCAPI by Google's crawler browser is unique. Solves the issue with Google's crawler getting the same result from nanoid() in two different runs, which results in the same PKCE code_challenge being used twice.
Exchange a refresh token for a new access token. Note: this func can run on client side. Only use private slas when the slas client secret is secured.
a configured instance of the ShopperLogin SDK client.
parameters to pass in the API calls.
a valid refresh token to exchange for a new access token (and refresh token).
the clientSecret (if applicable) to login with.
TokenResponse
Generated using TypeDoc
Generates the types required on a method, based on those provided in the config.