Show:

Contains all Requests regarding user/account and authentication

Methods

authenticate
(
  • data
)
Object
async

Signs in the user

Parameters:

  • data Object
    • Contains { email: string, password: string, clientId: string, clientSecret: string, referrer: string, refreshToken: string, }

Returns:

Object

Example:

InPlayer.Account.authenticate({
 email: 'test@test.com',
 password: 'test123',
 clientId: '123-123-hf1hd1-12dhd1',
 referrer: 'http://localhost:3000/',
 refreshToken: '528b1b80-ddd1hj-4abc-gha3j-111111'
})
.then(data => console.log(data));
changePassword
(
  • data
  • token
)
Object
async

Changes password for a given user

Parameters:

  • data Object
    • Contains { oldPassword: string password: string passwordConfirmation: string brandingId?: number }
  • token String
    • The reset token

Returns:

Object

Example:

InPlayer.Account
.changePassword({
  oldPassword: 'old123',
  password: 'test123',
  passwordConfirmation: 'test123'
  brandingId: 1234
},'123124-1r-1r13ur1h1')
.then(data => console.log(data));
deleteAccount
(
  • data
)
Object
async

Deletes an account

Parameters:

  • data Object
    • Contains { password: string, brandingId?: number, }

Returns:

Object

Example:

InPlayer.Account.deleteAccount({
 password: "password",
 brandingId: 1234,
})
.then(data => console.log(data));
exportData
(
  • data
)
Object
async

Exports account data to the users' email

Parameters:

  • data Object
    • Contains { password: string, brandingId?: number, }

Returns:

Object

Example:

InPlayer.Account.exportData({
   password: "password",
   brandingId: 1234,
})
.then(data => console.log(data));
getAccount () Object
async

Gets the account information for a given auth token

Returns:

Object

Example:

InPlayer.Account
.getAccount()
.then(data => console.log(data));
getRegisterFields
(
  • merchantUuid
)
Object
async

Gets register fields

Parameters:

  • merchantUuid String
    • The merchant UUID

Returns:

Object

Example:

InPlayer.Account
.getRegisterFields('123124-1r-1r13ur1h1')
.then(data => console.log(data));
getSocialLoginUrls
(
  • state
)
Object
async

Gets the social login urls for fb/twitter/google

Parameters:

  • state String
    • Social login state. The state needs to be json and base64 encoded to be sent as a query parameter. Example: btoa(JSON.stringify({uuid: 'foo', redirect: 'http://example.com'}))

Returns:

Object

Example:

InPlayer.Account
.getSocialLoginUrls('123124-1r-1r13ur1h1')
.then(data => console.log(data));
getToken () Credentials

Returns:

Credentials

Example:

InPlayer.Account.getToken()

isAuthenticated () Boolean

Checks if the user is authenticated

Returns:

Boolean

Example:

InPlayer.Account.isAuthenticated()

loadMerchantRestrictionSettings
(
  • merchantUuid
)
Object
async

Return restriction settings per Merchant

Parameters:

  • merchantUuid String
    • The merchant UUID

Returns:

Object:

Contains the data - { "age_verification_type": "pin_code", "age_verification_enabled": true, "merchant_uuid": "3b39b5ab-b5fc-4ba3-b770-73155d20e61f", "created_at": 1532425425, "updated_at": 1532425425 }

Example:

InPlayer.Account
.loadMerchantRestrictionSettings("528b1b80-5868-4abc-a9b6-4d3455d719c8")
.then(data => console.log(data));
refreshToken
(
  • clientId
)
Object
async

Refreshes the token

Parameters:

  • clientId Object
    • The merchant's clientId

Returns:

Object

Example:

InPlayer.Account.refreshToken('123123121-d1-t1-1ff').then(data => console.log(data))
requestNewPassword
(
  • data
)
Object
async

Requests new password for a given user

Parameters:

  • data Object
    • Contains { email: string, merchantUuid: string brandingId?: number }

Returns:

Object

Example:

InPlayer.Account
.requestNewPassword({
 email: "test32@test.com",
 merchantUuid: "528b1b80-5868-4abc-a9b6-4d3455d719c8",
 brandingId: 12345,
})
.then(data => console.log(data));
sendPinCode
(
  • brandingId
)
Object
async

Creates pin code and sends it to the users' email

Parameters:

  • brandingId Number
    • Optional parametar

Returns:

Object

Example:

InPlayer.Account.sendPinCode(1234)
.then(data => console.log(data));
setNewPassword
(
  • data
  • token
)
Object
async

Sets new password for the user

Parameters:

  • data Object
    • Contains { password: string passwordConfirmation: string brandingId?: number }
  • token String
    • The reset token

Returns:

Object

Example:

InPlayer.Account
.setNewPassword({
 password: "password",
 passwordConfirmation: "password",
 brandingId: "12345",
}, 'afhqi83rji74hjf7e43df')
.then(data => console.log(data));
setToken
(
  • token
  • refreshToken
  • expiresAt
)

Parameters:

  • token String
  • refreshToken String
  • expiresAt Number

Example:

InPlayer.Account.setToken('344244-242242', '123123121-d1-t1-1ff',1558529593297)

signOut () Object
async

Signs out the user and destroys cookies

Returns:

Object

Example:

InPlayer.Account.signOut()
.then(data => console.log(data));
signUp
(
  • data
)
Object
async

Signs up/Registers user

Parameters:

  • data Object
    • Contains { fullName: string, email: string password: string, passwordConfirmation: string, clientId: string, type: string, referrer: string, brandingId?: number, metadata?: { [key: string]: string } }

Returns:

Object

Example:

InPlayer.Account.signUp({
 fullName: "test",
 email: "test32@test.com",
 password: "12345678",
 passwordConfirmation: "12345678",
 clientId: "528b1b80-5868-4abc-a9b6-4d3455d719c8",
 type: "consumer",
 referrer: "http://localhost:3000/",
 brandingId?: 12345,
 metadata : { country: "Macedonia" },
})
.then(data => console.log(data));
updateAccount
(
  • data
)
Object
async

Updates the account info. Metadata fields must be from the Inplayer.getRegisterFields()

Parameters:

  • data Object
    • The new data for the account

Returns:

Object

Example:

InPlayer.Account
.updateAccount({fullName: 'test test', metadata: {country: 'Germany'}, dateOfBirth: '1999-03-05'})
.then(data => console.log(data));
validatePinCode
(
  • pinCode
)
Object
async

Checks validity of pin code

Parameters:

  • pinCode String
    • Code from received email message

Returns:

Object

Example:

InPlayer.Account.validatePinCode('5566')
.then(data => console.log(data));