Configuring Country Code Availability for SMS

By default, the Account Kit SDK allows users to enter a phone number for any country code supported by Account Kit. For the list of supported country codes, see SMS Country Codes. You can customize availability by setting either a country code whitelist or a country code blacklist in the loginViewController. The following table shows the possible combinations of lists and the results.

Lists Result

No whitelist or blacklist

All country codes supported by Account Kit are available.

Whilelist

Only country codes in the whitelist are available.

Blacklist

All country codes supported by Account Kit except those in the blacklist are available.

Whitelist and blacklist

Only the country codes in the whitelist that are not also in the blacklist are available. Note that the blacklist takes priority for codes that that are in both lists.

Whitelisting Country Codes

Whitelisting a set of countries restricts the country code selector to only those countries in the whitelist. Specify a whitelist array in loginViewController.whitelistedCountryCodes.

The value is an array of 2-letter country codes as defined by ISO 3166-1 Alpha 2. The following example restricts availability to just the US +1 and the Netherlands +31.

- (void)_prepareLoginViewController:(UIViewController<AKFViewController> *)loginViewController
{
  ...
  loginViewController.whitelistedCountryCodes = @[@"US", @"NL"];
  ...
}

Blacklisting Country Codes

Blacklisting a set of countries allows a user to use all of Account Kit's supported countries except those defined in the blacklist. Set a blacklist in loginViewController.blacklistedCountryCodes.

Just like the whitelist, the value is an array of short country codes as defined by ISO 3166-1 Alpha 2. The following example allows access everywhere that Account Kit is supported, except ID +62.

- (void)_prepareLoginViewController:(UIViewController<AKFViewController> *)loginViewController
{
  ...
  loginViewController.blacklistedCountryCodes = @[@"ID"];
  ...
}

Default Country Code

You can configure your default country code by setting a country code in loginViewController.defaultCountryCode. The following example sets the default country code to the US +1.

(void)_prepareLoginViewController:(UIViewController<AKFViewController> *)loginViewController
{

...
loginViewController.defaultCountryCode = @"US";
...
}