auth

Playtech.API. auth

Members

# (static) isLoggedIn

Example
Playtech.API.auth.isLoggedIn;

Methods

# (static) addAfterCredentialsLoginCallback(callback)

Add callback after login with credentials.
Parameters:
Name Type Description
callback function (resolve, reject) => {...}
Example
Playtech.API.auth.addAfterCredentialsLoginCallback((resolve, reject) => setTimeout(() => resolve(), 2000));

# (static) addBeforeRegistrationHook(callback)

Add callback to modify the data that is sent to IMS during registration. It must return all arguments that it was given.
Parameters:
Name Type Description
callback function (dataMap) => {... return { dataMap }} dataMap from registration form
Example
Playtech.API.auth.addBeforeRegistrationHook(({ dataMap }) => {
    // modify phone right before registration request is sent
    dataMap.phone = '+123';

    return { dataMap };
});

# (static) getFitToPlaySubmissionRequired() → {boolean}

Get whether fitToPlaySubmissionRequired is set to '1'.
Returns:
Type
boolean
Example
Playtech.API.auth.getFitToPlaySubmissionRequired();

# (static) getTemporaryAuthenticationToken(serviceTypeopt) → {Promise.<string>}

Get temporary authentication token for logged in user.
Parameters:
Name Type Attributes Default Description
serviceType string <optional>
GamePlay
Returns:
Type
Promise.<string>
Example
Playtech.API.auth.getTemporaryAuthenticationToken();

# (static) getTwoFactorConfiguration() → {Promise.<{Object}>}

Get Two Factor configuration data. Ims docs.
Returns:
{ twoFactorConf: { enabled: boolean, loginDeviceSupported: boolean, rememberMeRequirePin: string, rememberMeWithoutTwoFactor: ('ON' | 'OFF'), rememberMeExpirationSec: number, loginDeviceExpirationSec: number, defaultChannel: string, onlyNumbers: boolean, unblockTokenExpirationSec: number, configuredServices: { service: string, option: ('ON' | 'OFF') }[], excludedClientTypePlatforms: { clientType: string, clientPlatform: string }[] }}
Type
Promise.<{Object}>
Example
Playtech.API.auth.getTwoFactorConfiguration().then(data => {...});

# (static) invokeAction(options) → {Promise.<{Object}>}

Runs the action of the token generated by PrepareAction call. Ims docs.
Parameters:
Name Type Description
options Object invokeAction options.
Properties
Name Type Attributes Description
token string Token that was generated in PrepareAction call.
challengeResponse string <optional>
Response to challenge. To be used only if challenge was also returned in PrepareAction call response.
parameters Array.<Object> <optional>
Action specific parameters as key-value list like so [{ key: 'key1', value: 'value1' }].
Returns:
{ result: [{ key: string, value: string }] }
Type
Promise.<{Object}>
Example
Playtech.API.auth.invokeAction({ token: 'tokenFromIMS' }).then(data => {...});

# (static) login(userName, password, rememberMeLoginopt) → {Promise.<void>}

Performs login.
Parameters:
Name Type Attributes Default Description
userName string
password string
rememberMeLogin boolean <optional>
false
Returns:
Type
Promise.<void>
Example
Playtech.API.auth.login('test2145', 'Password1!').then(() => {...});

# (static) loginByTemporaryToken(userName, token, loginModeopt) → {Promise.<void>}

Login by temporary token.
Parameters:
Name Type Attributes Description
userName string User name to login with.
token string Temporary token to login with.
loginMode string <optional>
used to determine the type of token provided (e.g externalToken).
Returns:
Type
Promise.<void>
Example
Playtech.API.auth.loginByTemporaryToken({ userName: 'testUser', token: 's-m1gTrP1qQeitJjwvHj8NDCBekaSAgHuZlGSUFqOQQMk-A0Xvif0xVLEBveYHinVbpCyZrfpDVXItCeT6-HE1rw' });

# (static) logout(isQuietopt) → {Promise.<void>}

Parameters:
Name Type Attributes Description
isQuiet boolean <optional>
Returns:
Type
Promise.<void>
Example
Playtech.API.auth.logout().then(() => {...});

# (static) register(dataMap, addressDetailsopt, contactAddressopt, depositLimitsopt, betLimitsopt, betLimitsActionopt, lossLimitsopt, lossLimitsActionopt, contactPreferencesopt, tagsopt, tokenopt, blackboxopt) → {Promise.<{playerCode: number, userId: string, actions: Object}>}

Create new player. see ims docs
Parameters:
Name Type Attributes Description
dataMap Object see ims docs.
addressDetails Object <optional>
see ims docs.
contactAddress Object <optional>
see ims docs.
depositLimits Object <optional>
see ims docs.
betLimits Object <optional>
see ims docs.
betLimitsAction string <optional>
Values: 'logout', 'message'.
lossLimits Object <optional>
see ims docs.
lossLimitsAction string <optional>
Values: 'logout', 'message'.
contactPreferences Object <optional>
Properties
Name Type Attributes Description
channel string <optional>
Values: 'email', 'phone', 'SMS', 'mobilePush', 'internalMessage', 'desktopCompanion', 'whatsApp', 'directMail'.
type string <optional>
Values: 'promotional', 'account', 'thirdParty'.
preference boolean <optional>
isInvalid boolean <optional>
True if channel is marked as invalid.
tags Array.<Object> <optional>
Properties
Name Type Attributes Description
name string <optional>
value string <optional>
Values: 'text', 'number', 'date', 'delta'
type string <optional>
comment string <optional>
expirationDate string <optional>
Format: yyyy-MM-dd 2016-04-13.
token string <optional>
Challenge-response token.
blackbox string <optional>
Examples: SomestringForIOBB
Returns:
For actions type see ims docs.
Type
Promise.<{playerCode: number, userId: string, actions: Object}>
Example
Playtech.API.auth.register({
      dataMap: {
          casinoName: 'playtech800075',
          clientSkin: 'playtech800075',
          title: 'Mr',
          firstname: 'test',
          lastname: 'test',
          sex: 'M',
          email: 'test2145@playtech.com',
          birthdate: '1986-01-01',
          countrycode: 'UA',
          state: 'Kyiv',
          city: 'Kyiv',
          zip: '01001',
          cellphone: '+38022112211',
          phone: '+380',
          address: 'svoboda street',
          userName: 'test2145',
          password: 'Password1!',
          verificationQuestion: 'test',
          verificationAnswer: 'test',
          currencyCode: 'GBP',
          coupon: '',
          advertiser: 'advertiser',
          clientPlatform: 'web',
          signupDeviceType: 'other',
          signupOsName: 'macintosh',
          signupOsVersion: 'x',
          signupDeliveryPlatform: 'Hub2',
          signupDeviceBrowser: 'chrome',
          language: 'EN',
          serial: '460916c7-bd41-42a8-ac82-d85a55924547',
          signupDeviceId: '460916c7-bd41-42a8-ac82-d85a55924547',
          clientType: 'casino'
      },
      contactPreferences: {
          channel: 'email',
          type: 'promotional',
          preference: false
      },
      addressDetails: {
          buildingName: 'My Building',
          buildingNumber: '1',
          subbuilding: '1',
          streetName: 'Sportivnaya',
          streetNumber: '1',
          propertyName: '-',
          propertyNumber: '12',
          suburb: 'Kyiv'
      },
      contactAddress: {
          city: 'Kyiv',
          countryCode: 'UA',
          zip: '01012'
      }
}).then(data => {...});

# (static) resendLogin2FAToken() → {Promise.<void>}

Resend 2FA token to user upon login flow.
Returns:
Type
Promise.<void>
Example
Playtech.API.auth.resendLogin2FAToken();

# (static) sendBatchRequest(requests, authParameters)

Aggregate multiple requests to IMS into one batch request. Could be used only after successful registration.
Parameters:
Name Type Description
requests Array.<Object> contains an array of requests to be sent to IMS.
authParameters Object contains auth parameters for the batch request.
Properties
Name Type Attributes Description
playerName string userId from registration response.
email string <optional>
user email.
systemId string <optional>
site systemId.
realMode boolean <optional>
demo or real mode.
casinoName boolean <optional>
site casinoName.
Example
Playtech.API.auth.sendBatchRequest({
     authParameters: { playerName: 'test123' },
     requests: [{
             ID: 35544,
             responses: [35545, 35546],
             description: 'Set player tags',
             tags,
             errorLevel: 1
     }]
});

# (static) showLogin()

Show login page or login popup.
Example
Playtech.API.auth.showLogin();

# (static) showLoginPopup(onCloseopt, onLoginopt, titleopt)

Shows login popup.
Parameters:
Name Type Attributes Description
onClose function <optional>
Callback on close popup
onLogin function <optional>
Callback on login
title string <optional>
Title of popup
Example
Playtech.API.auth.showLoginPopup({ onClose: (event) => {...}, onLogin: () => {...}, title: 'Login' });

# (static) validateSession() → {Promise.<{Object}>}

Validates current session. Allows to check if MFA 2FA, etc is required. Ims docs.
Returns:
{ sessionValidationByMfa?: { provider: string, properties: { name: string, value: string }[] } }
Type
Promise.<{Object}>
Example
Playtech.API.auth.validateSession().then(data => {...});