Options
All
  • Public
  • Public/Protected
  • All
Menu

Contains all Requests regarding user account and authentication.

Hierarchy

  • BaseExtend
    • Account

Index

Constructors

constructor

  • new Account(config: ApiConfig, request: Request): Account
  • Parameters

    • config: ApiConfig
    • request: Request

    Returns Account

Properties

config

config: ApiConfig

getToken

getToken: () => CredentialsConfig | Promise<CredentialsConfig> = ...

Type declaration

isAuthenticated

isAuthenticated: () => boolean | Promise<boolean> = ...

Type declaration

    • (): boolean | Promise<boolean>
    • Returns a boolean if the user is authenticated

      Returns boolean | Promise<boolean>

removeToken

removeToken: () => void | Promise<void> = ...

Type declaration

    • (): void | Promise<void>
    • Removes the token from browser's localStorage object

      Returns void | Promise<void>

request

request: Request

setToken

setToken: (token: string, refreshToken: string, expiresAt: number) => void | Promise<void> = ...

Type declaration

    • (token: string, refreshToken: string, expiresAt: number): void | Promise<void>
    • Sets the Token in browser's localStorage object

      Parameters

      • token: string

        The authorisation token of the logged in account.

      • refreshToken: string

        The refresh token of the logged in account.

      • expiresAt: number

        The token's expiration date of the logged in account.

      Returns void | Promise<void>

Methods

changePassword

  • changePassword(__namedParameters: { brandingId?: number; oldPassword: string; password: string; passwordConfirmation: string }): Promise<AxiosResponse<void>>
  • Changes password for a given user

    method

    changePassword

    async
    example
    InPlayer.Account
    .changePassword({
    oldPassword: 'old123',
    password: 'test123',
    passwordConfirmation: 'test123'
    brandingId: 1234
    })
    .then(data => console.log(data));

    Parameters

    • __namedParameters: { brandingId?: number; oldPassword: string; password: string; passwordConfirmation: string }
      • Optional brandingId?: number
      • oldPassword: string
      • password: string
      • passwordConfirmation: string

    Returns Promise<AxiosResponse<void>>

deleteAccount

  • deleteAccount(__namedParameters: { brandingId?: number; password: string }): Promise<AxiosResponse<CommonResponse>>
  • Deletes an account

    method

    deleteAccount

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

    Parameters

    • __namedParameters: { brandingId?: number; password: string }
      • Optional brandingId?: number
      • password: string

    Returns Promise<AxiosResponse<CommonResponse>>

    Contains the data:

    {
    code: 200,
    message: "Account successfully deleted"
    }

exportData

  • exportData(__namedParameters: { brandingId?: number; password: string }): Promise<AxiosResponse<CommonResponse>>
  • Exports account data to the users' email

    method

    exportData

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

    Parameters

    • __namedParameters: { brandingId?: number; password: string }
      • Optional brandingId?: number
      • password: string

    Returns Promise<AxiosResponse<CommonResponse>>

    Contains the data:

    {
    code: 200,
    message: "Account successfully exported"
    }

getAccountInfo

  • Gets the account information for a given auth token

    method

    getAccountInfo

    async
    example
    InPlayer.Account
    .getAccountInfo()
    .then(data => console.log(data));

    Returns Promise<AxiosResponse<AccountData>>

    Contains the data:

    {
    id: number;
    email: string;
    full_name: string;
    referrer: string;
    metadata: Record<string, unknown>;
    social_apps_metadata: Record<string, unknown>[];
    roles: string[];
    completed: boolean;
    created_at: number;
    updated_at: number;
    date_of_birth: number;
    uuid: string;
    merchant_uuid: string;
    }

getRegisterFields

  • getRegisterFields(merchantUuid?: string): Promise<AxiosResponse<GetRegisterField>>
  • Gets register fields

    method

    getRegisterFields

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

    Parameters

    • merchantUuid: string = ''

      The Merchant's unique universal identifier (Merchant UUID). You can find it on the InPlayer's dashboard at the Account Details section as Account ID.

    Returns Promise<AxiosResponse<GetRegisterField>>

    Contains the data:

    {
    id: number;
    name: string;
    label: string;
    type: string;
    required: boolean;
    default_value: string;
    placeholder: string;
    options: [{
    [key: string]: string;
    }];
    }

getSocialLoginUrls

  • getSocialLoginUrls(state: string): Promise<AxiosResponse<ListSocialURLs>>
  • Gets the social login urls for fb/twitter/google

    method

    getSocialLoginUrls

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

    Parameters

    • state: string

      The 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 Promise<AxiosResponse<ListSocialURLs>>

    Contains the data:

    {
    ocial_urls: [
    facebook: string;
    twitter: string;
    google: string;
    ];
    code: number;
    }

loadMerchantRestrictionSettings

  • Returns restriction settings per Merchant

    method

    loadMerchantRestrictionSettings

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

    Parameters

    • merchantUuid: string

      The Merchant's unique universal identifier (Merchant UUID). You can find it on the InPlayer's dashboard at the Account Details section as Account ID.

    Returns Promise<AxiosResponse<RestrictionSettingsData>>

    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
    }

refreshToken

  • refreshToken(clientId: string): Promise<AxiosResponse<CreateAccount>>
  • Refreshes the token

    method

    refreshToken

    async
    throws

    Will throw an HTTP 401 error if the refresh token is not present.

    example
    InPlayer.Account.refreshToken('123123121-d1-t1-1ff').then(data => console.log(data))
    

    Parameters

    • clientId: string

      The Merchant's unique universal identifier (Merchant UUID). You can find it on the InPlayer's dashboard at the Account Details section as Account ID.

    Returns Promise<AxiosResponse<CreateAccount>>

    Contains the data:

    {
    access_token: string;
    refresh_token: string;
    expires: number;
    account: {
    id: number,
    email: string,
    full_name: string,
    referrer: string,
    metadata: Record<string, unknown>,
    social_apps_metadata: Object[],
    roles: string[],
    completed: boolean,
    date_of_birth: number,
    created_at: number,
    updated_at: number,
    uuid: string;
    merchant_uuid: string;
    }
    }

reportSSOtoken

  • reportSSOtoken(ssoDomain: string, token: string, deactivate?: boolean): Promise<AxiosResponse<any>>
  • Reports the generated SSO token to the SSO domain.

    Parameters

    • ssoDomain: string

      The SSO domain.

    • token: string

      The authorisation token of the logged in account.

    • deactivate: boolean = false

      Should the token be deactivated or activated. If it is not set the token won't be deactivated.

    Returns Promise<AxiosResponse<any>>

requestNewPassword

  • requestNewPassword(__namedParameters: { brandingId: number; email: string; merchantUuid: string }): Promise<AxiosResponse<CommonResponse>>
  • Requests new password for a given user

    method

    requestNewPassword

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

    Parameters

    • __namedParameters: { brandingId: number; email: string; merchantUuid: string }
      • brandingId: number
      • email: string
      • merchantUuid: string

    Returns Promise<AxiosResponse<CommonResponse>>

    Promise<AxiosResponse> Contains the data:

    {
    code: 200,
    message: ''
    }

sendPinCode

  • sendPinCode(brandingId: number): Promise<AxiosResponse<CommonResponse>>
  • Creates pin code and sends it to the users' email

    method

    sendPinCode

    async
    example
    InPlayer.Account.sendPinCode(1234)
    .then(data => console.log(data));

    Parameters

    • brandingId: number

      The id of created branding theme in InPlayer Dashboard. If it is not set the default branding details will be returned.

    Returns Promise<AxiosResponse<CommonResponse>>

    Contains the data:

    {
    code: 200,
    message: "Pin code successfully sent"
    }

setNewPassword

  • setNewPassword(__namedParameters: { brandingId: number; password: string; passwordConfirmation: string }, token?: string): Promise<AxiosResponse<void>>
  • Sets new password for the user

    method

    setNewPassword

    async
    example
    InPlayer.Account
    .setNewPassword({
    password: "password",
    passwordConfirmation: "password",
    brandingId: "12345",
    }, 'afhqi83rji74hjf7e43df')
    .then(data => console.log(data));

    Parameters

    • __namedParameters: { brandingId: number; password: string; passwordConfirmation: string }
      • brandingId: number
      • password: string
      • passwordConfirmation: string
    • token: string = ''

      The reset token from received email message after successfull new password request.

    Returns Promise<AxiosResponse<void>>

signIn

  • signIn(__namedParameters: { clientId: string; clientSecret?: string; email: string; password?: string; referrer?: string; refreshToken?: string; username?: string }): Promise<AxiosResponse<CreateAccount>>
  • Signs in the user

    method

    signIn

    async
    example
    InPlayer.Account.signIn({
    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));

    Parameters

    • __namedParameters: { clientId: string; clientSecret?: string; email: string; password?: string; referrer?: string; refreshToken?: string; username?: string }
      • clientId: string
      • Optional clientSecret?: string
      • email: string
      • Optional password?: string
      • Optional referrer?: string
      • Optional refreshToken?: string
      • Optional username?: string

    Returns Promise<AxiosResponse<CreateAccount>>

    Contains the data:

    {
    access_token: string,
    refresh_token: string,
    expires: number;
    account: {
    id: number,
    email: string,
    full_name: string,
    referrer: string,
    metadata: Record<string, unknown>,
    social_apps_metadata: Object[],
    roles: string[],
    completed: boolean,
    date_of_birth: number,
    created_at: number,
    updated_at: number,
    uuid: string;
    merchant_uuid: string;
    }
    }

signInV2

  • signInV2(__namedParameters: { clientId: string; email: string; password: string; referrer: string }): Promise<AxiosResponse<CreateAccountV2>>
  • Signs in the user v2

    method

    signInV2

    async
    example
    InPlayer.Account.signInV2({
    email: 'test@test.com',
    password: 'test123',
    clientId: '123-123-hf1hd1-12dhd1',
    referrer: 'http://localhost:3000/',
    })
    .then(data => console.log(data));

    Parameters

    • __namedParameters: { clientId: string; email: string; password: string; referrer: string }
      • clientId: string
      • email: string
      • password: string
      • referrer: string

    Returns Promise<AxiosResponse<CreateAccountV2>>

    Contains the data:

    {
    access_token: string,
    refresh_token: string,
    expires: number;
    account: {
    id: number,
    email: string,
    full_name: string,
    referrer: string,
    metadata: Record<string, unknown>,
    social_apps_metadata: Object[],
    roles: string[],
    completed: boolean,
    date_of_birth: number,
    created_at: number,
    updated_at: number,
    uuid: string;
    merchant_uuid: string;
    }
    }

signOut

  • signOut(): Promise<AxiosResponse<undefined>>
  • Signs out the user and destroys cookies

    method

    signOut

    async
    example
    InPlayer.Account.signOut()
    .then(data => console.log(data));

    Returns Promise<AxiosResponse<undefined>>

signUp

  • signUp(__namedParameters: { brandingId?: number; clientId: string; email: string; fullName: string; metadata?: {}; password: string; passwordConfirmation: string; referrer: string; type: "consumer" }): Promise<AxiosResponse<CreateAccount>>
  • Signs up/Registers user

    method

    signUp

    async
    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));

    Parameters

    • __namedParameters: { brandingId?: number; clientId: string; email: string; fullName: string; metadata?: {}; password: string; passwordConfirmation: string; referrer: string; type: "consumer" }
      • Optional brandingId?: number
      • clientId: string
      • email: string
      • fullName: string
      • Optional metadata?: {}
        • [key: string]: string
      • password: string
      • passwordConfirmation: string
      • referrer: string
      • type: "consumer"

    Returns Promise<AxiosResponse<CreateAccount>>

    Contains the data:

    {
    access_token: string;
    refresh_token: string;
    expires: number;
    account: {
    id: number,
    email: string,
    full_name: string,
    referrer: string,
    metadata: Record<string, unknown>,
    social_apps_metadata: Object[],
    roles: string[],
    completed: boolean,
    date_of_birth: number,
    created_at: number,
    updated_at: number,
    uuid: string;
    merchant_uuid: string;
    }
    }

signUpV2

  • signUpV2(__namedParameters: { brandingId?: number; clientId: string; email: string; fullName: string; metadata?: {}; password: string; passwordConfirmation: string; referrer: string; type: "consumer" }): Promise<AxiosResponse<CreateAccount>>
  • Signs up/Registers user v2

    method

    signUpV2

    async
    example
    InPlayer.Account.signUpV2({
    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));

    Parameters

    • __namedParameters: { brandingId?: number; clientId: string; email: string; fullName: string; metadata?: {}; password: string; passwordConfirmation: string; referrer: string; type: "consumer" }
      • Optional brandingId?: number
      • clientId: string
      • email: string
      • fullName: string
      • Optional metadata?: {}
        • [key: string]: string
      • password: string
      • passwordConfirmation: string
      • referrer: string
      • type: "consumer"

    Returns Promise<AxiosResponse<CreateAccount>>

    Contains the data:

    {
    access_token: string;
    refresh_token: string;
    expires: number;
    account: {
    id: number,
    email: string,
    full_name: string,
    referrer: string,
    metadata: Record<string, unknown>,
    social_apps_metadata: Object[],
    roles: string[],
    completed: boolean,
    date_of_birth: number,
    created_at: number,
    updated_at: number,
    uuid: string;
    merchant_uuid: string;
    }
    }

syncWithExternalAccount

  • syncWithExternalAccount(integration: string, itemId: number): Promise<AxiosResponse<AccountProfile>>
  • Creates or returns an existing external account integrated with an InPlayer fan account

    method

    syncWithExternalAccount

    async
    example
    InPlayer.Account
    .syncWithExternalAccount('livelike', 12345)
    .then(data => console.log(data));

    Parameters

    • integration: string

      The name of the external integration

    • itemId: number

      The id of created premium content in InPlayer Dashboard (i.e asset id or package id).

    Returns Promise<AxiosResponse<AccountProfile>>

    Contains the data:

    {
    id: 3, // The record id
    account_id: 54321, // The InPlayer account id
    token: '45b1b30-aa2f1h-9abc-j5dsg-78d36d' // The external integration longlived token
    }

updateAccount

  • updateAccount(__namedParameters: { dateOfBirth?: string; fullName: string; metadata?: {} }): Promise<AxiosResponse<void>>
  • Updates the account info. Metadata fields must be from the Inplayer.getRegisterFields()

    method

    updateAccount

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

    Parameters

    • __namedParameters: { dateOfBirth?: string; fullName: string; metadata?: {} }
      • Optional dateOfBirth?: string
      • fullName: string
      • Optional metadata?: {}
        • [key: string]: string

    Returns Promise<AxiosResponse<void>>

updateExternalAccount

  • updateExternalAccount(integration: string, body: Record<string, any>): Promise<AxiosResponse<any>>
  • Updates an existing external account integrated with an InPlayer fan account

    method

    updateExternalAccount

    async
    example
    InPlayer.Account
    .updateExternalAccount('livelike', { nickname: 'My New Nickname' })
    .then(data => console.log(data));

    Parameters

    • integration: string

      The name of the external integration The additional required and/or optional fields that merchants can choose to require from their end-users to fill in upon registration.

    • body: Record<string, any>

      The external account fields with updated by user values (For example: new nickname value)

    Returns Promise<AxiosResponse<any>>

validatePinCode

  • validatePinCode(pinCode: string): Promise<AxiosResponse<CommonResponse>>
  • Checks validity of pin code

    method

    validatePinCode

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

    Parameters

    • pinCode: string

      The pin code from received email message.

    Returns Promise<AxiosResponse<CommonResponse>>

    Contains the data:

    {
    code: 200,
    message: "Pin code is valid"
    }

Generated using TypeDoc