Manual Reference Source Test
import IdentityConfig from 'src/modules/identity-config.js'
public class | source

IdentityConfig

Identity SDK configuration

The way the properties map works is that you specify any IdentityProperty overrides for standard properties or a complete IdentityProperty configuration for custom properties.

For a list of standard properties see: IdentityProperty.standardMap.

Static Method Summary

Static Public Methods
public static

Returns Promise of IdentityConfig from specified server and with specified App key

Constructor Summary

Public Constructor
public

constructor(defaultPage: string, redirectUrls: string[], properties: Map<string, Object>, facebook: Map<string, string>, google: Map<string, string>, sessionTimeout: number, userTimeout: number, theme: Object, analytics: Object, zeroBounce: Object)

IdentityConfig constructor

Static Public Methods

public static request(): Promise<IdentityConfig, Error> source

Returns Promise of IdentityConfig from specified server and with specified App key

For each NBC App an IdentityConfig should be stored at: https://id.nbc.com/sdk/config/<key>.json Where <key> is the App key, e.g: example => https://id.nbc.com/sdk/config/example.json

For non production environments this URL will change accordingly, e.g. for dev: https://dev-id.nbc.com/sdk/config/example.json

Params:

NameTypeAttributeDescription
options.server IdentityServer
  • optional

IdentityServer to get config from

options.key String
  • optional

Key of App to get configuration for

options.configLocationHost String
  • optional

Custom config host url

Return:

Promise<IdentityConfig, Error>

Promise of IdentityConfig

Example:

{
  "redirectUrls": [
    "https://id.nbc.com/sdk/example/"
  ],
  "properties": {
    "email": {}, // allow this credential to be used
    "firstName": { // extend config to request and require this whenever a user authenticates
      "request": true,
      "required": true
    },
    "lastName": { // request (but not require) this whenever a user authenticates
      "request": true
    },
    "sponsorOptIn": { // specify a complete configuration for custom properties (e.g: prefixed by app key)
      "label": "I want to get cool stuff from Sponsor",
      "type": "boolean",
      "required": true,
      "default_value": true
    }
  },
  "facebook": {
    "appId": "1234", // use a non standard Facebook App
    "permissions": ["email", "user_friends"] // besides the usual email, also ask for friends
  }
}

Public Constructors

public constructor(defaultPage: string, redirectUrls: string[], properties: Map<string, Object>, facebook: Map<string, string>, google: Map<string, string>, sessionTimeout: number, userTimeout: number, theme: Object, analytics: Object, zeroBounce: Object) source

IdentityConfig constructor

Params:

NameTypeAttributeDescription
defaultPage string
  • optional
  • default: 'signUp'

The default page to load on init

redirectUrls string[]
  • optional
  • default: []

White list of redirect URLs to accept

properties Map<string, Object>
  • optional
  • default: {}

Map of user property keys to configurations

facebook Map<string, string>
  • optional
  • default: {}

Facebook config

google Map<string, string>
  • optional
  • default: {}

Google config

sessionTimeout number
  • optional
  • default: 31536000

Session token timeout in seconds, default 1 year

userTimeout number
  • optional
  • default: 3600

User data cache timeout in seconds, default 1 hour

theme Object
  • optional
  • default: {}

Customizable theme parameters

analytics Object
  • optional
  • default: {}

Analytics settings

zeroBounce Object
  • optional
  • default: {}

ZeroBounce settings