Authentication
Admin authentication is provided via the AdminAuthProvider.
import { AdminAuthProvider } from '@wll-sdk/api';Example: initializing the WLL Rewards SDK with an AdminAuthProvider
import { WLLRewardsSdk, AdminAuthProvider } from '@wll-sdk/api';
new WLLRewardsSdk({
apiKey: '<your-api-key>',
authProvider: new AdminAuthProvider({
clientId: '<your-client-id>',
clientSecret: '<your-client-secret>',
}),
baseUrl: 'https://api.rewards.wlloyalty.net/v1',
});The AdminAuthProvider will automatically extract which region you are using from the baseUrl and attempt to authenticate. Current regions supported by the SDK:
EU
US
AdminAuthConfig Reference
clientId
string
Y
clientSecret
string
Y
grantType
string?
N
audience
string?
N
scope
string?
N
Tenant authentication is provided via the StaticAuthProvider.
The StaticAuthProvider is a simple implementation of AuthProvider that takes a token in its constructor and always returns that token. It is useful for tenant authentication after completing your authentication flow, or for admin authentication if you store an admin token.
Example: initializing the WLL Rewards SDK with a StaticAuthProvider
StaticAuthConfig Reference
token
string
Y
If needed, implement your own AuthProvider. The abstract class AuthProvider is exported by the SDK. Implementing it lets you pass a custom provider to the SDK (for example, fetching a token from a remote cache).
Abstract method signature:
Example: minimal custom auth provider
Last updated
Was this helpful?