I'm using the PhoneFactor-InputOrVerify for my custom policy MFA. If a user does not have a phone number registered, it will ask them to enter one. Part of this is a dropdown list of countries that the phone is registered in (so that it can get the country code). I've managed to trim this list down to just a few countries, using the following TechnicalProfile
<TechnicalProfile Id="PhoneFactor-InputOrVerify">
<DisplayName>PhoneFactor</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.PhoneFactorProtocolProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="ContentDefinitionReferenceId">api.phonefactor</Item>
<Item Key="ManualPhoneNumberEntryAllowed">true</Item>
<Item Key="setting.authenticationMode">sms</Item>
<Item Key="setting.autodial">true</Item>
<Item Key="language.countryList"><![CDATA[{"IE": "Ireland","IM": "Isle of Man","GB": "United Kingdom","US": "United States","DE": "Germany"}]]></Item>
</Metadata>
<CryptographicKeys>
<Key Id="issuer_secret" StorageReferenceId="B2C_1A_TokenSigningKeyContainer" />
</CryptographicKeys>
<InputClaimsTransformations>
<InputClaimsTransformation ReferenceId="CreateUserIdForMFA" />
</InputClaimsTransformations>
<InputClaims>
<InputClaim ClaimTypeReferenceId="userIdForMFA" PartnerClaimType="UserId" />
<InputClaim ClaimTypeReferenceId="strongAuthenticationPhoneNumber" />
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="Verified.strongAuthenticationPhoneNumber" PartnerClaimType="Verified.OfficePhone" />
<OutputClaim ClaimTypeReferenceId="newPhoneNumberEntered" PartnerClaimType="newPhoneNumberEntered" />
<OutputClaim ClaimTypeReferenceId="isActiveMFASession" DefaultValue="true"/>
</OutputClaims>
</TechnicalProfile>
The problem is that it always defaults to the United States, I want to be able to set what country code the dropdown defaults to. Anyone know how I do this?
I've tried adding "DEFAULT": "United Kingdom",
to the start of the JSON however, just just adds another selection to the list.
Have you tried moving "GB": "United Kingdom"
in front of the list and removing "DEFAULT": "Country/Region"
?
Another possibility is to use Java Script to customize the dropdown but would only recommend that if this behavior is not achievable via policy.
Here is a working example where I have updated the policy to use language customization feature in B2C. Basically moved the GB at the top of Country_List item and remove entry for DEFAULT.
{
"LocalizedStrings": [
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "alternative_text",
"Override": false,
"Value": "I don't have my phone"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "button_cancel",
"Override": false,
"Value": "Cancel"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "button_retry",
"Override": false,
"Value": "Retry"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "button_send_code",
"Override": false,
"Value": "Send Code"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "button_verify",
"Override": false,
"Value": "Call Me"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "button_verify_code",
"Override": false,
"Value": "Verify Code"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "cancel_message",
"Override": false,
"Value": "The user has cancelled multi-factor authentication"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "code_pattern",
"Override": false,
"Value": "\\d{6}"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "countryList",
"Override": true,
"Value": "{\"GB\":\"United Kingdom\", \"AF\":\"Afghanistan\",\"AX\":\"Åland Islands\",\"AL\":\"Albania\",\"DZ\":\"Algeria\",\"AS\":\"American Samoa\",\"AD\":\"Andorra\",\"AO\":\"Angola\",\"AI\":\"Anguilla\",\"AQ\":\"Antarctica\",\"AG\":\"Antigua and Barbuda\",\"AR\":\"Argentina\",\"AM\":\"Armenia\",\"AW\":\"Aruba\",\"AU\":\"Australia\",\"AT\":\"Austria\",\"AZ\":\"Azerbaijan\",\"BS\":\"Bahamas\",\"BH\":\"Bahrain\",\"BD\":\"Bangladesh\",\"BB\":\"Barbados\",\"BY\":\"Belarus\",\"BE\":\"Belgium\",\"BZ\":\"Belize\",\"BJ\":\"Benin\",\"BM\":\"Bermuda\",\"BT\":\"Bhutan\",\"BO\":\"Bolivia\",\"BQ\":\"Bonaire\",\"BA\":\"Bosnia and Herzegovina\",\"BW\":\"Botswana\",\"BV\":\"Bouvet Island\",\"BR\":\"Brazil\",\"IO\":\"British Indian Ocean Territory\",\"VG\":\"British Virgin Islands\",\"BN\":\"Brunei\",\"BG\":\"Bulgaria\",\"BF\":\"Burkina Faso\",\"BI\":\"Burundi\",\"CV\":\"Cabo Verde\",\"KH\":\"Cambodia\",\"CM\":\"Cameroon\",\"CA\":\"Canada\",\"KY\":\"Cayman Islands\",\"CF\":\"Central African Republic\",\"TD\":\"Chad\",\"CL\":\"Chile\",\"CN\":\"China\",\"CX\":\"Christmas Island\",\"CC\":\"Cocos (Keeling) Islands\",\"CO\":\"Colombia\",\"KM\":\"Comoros\",\"CG\":\"Congo\",\"CD\":\"Congo (DRC)\",\"CK\":\"Cook Islands\",\"CR\":\"Costa Rica\",\"CI\":\"Côte d’Ivoire\",\"HR\":\"Croatia\",\"CU\":\"Cuba\",\"CW\":\"Curaçao\",\"CY\":\"Cyprus\",\"CZ\":\"Czechia\",\"DK\":\"Denmark\",\"DJ\":\"Djibouti\",\"DM\":\"Dominica\",\"DO\":\"Dominican Republic\",\"EC\":\"Ecuador\",\"EG\":\"Egypt\",\"SV\":\"El Salvador\",\"GQ\":\"Equatorial Guinea\",\"ER\":\"Eritrea\",\"EE\":\"Estonia\",\"SZ\":\"Eswatini\",\"ET\":\"Ethiopia\",\"FK\":\"Falkland Islands\",\"FO\":\"Faroe Islands\",\"FJ\":\"Fiji\",\"FI\":\"Finland\",\"FR\":\"France\",\"GF\":\"French Guiana\",\"PF\":\"French Polynesia\",\"TF\":\"French Southern Territories\",\"GA\":\"Gabon\",\"GM\":\"Gambia\",\"GE\":\"Georgia\",\"DE\":\"Germany\",\"GH\":\"Ghana\",\"GI\":\"Gibraltar\",\"GR\":\"Greece\",\"GL\":\"Greenland\",\"GD\":\"Grenada\",\"GP\":\"Guadeloupe\",\"GU\":\"Guam\",\"GT\":\"Guatemala\",\"GG\":\"Guernsey\",\"GN\":\"Guinea\",\"GW\":\"Guinea-Bissau\",\"GY\":\"Guyana\",\"HT\":\"Haiti\",\"HM\":\"Heard Island and McDonald Islands\",\"HN\":\"Honduras\",\"HK\":\"Hong Kong SAR\",\"HU\":\"Hungary\",\"IS\":\"Iceland\",\"IN\":\"India\",\"ID\":\"Indonesia\",\"IR\":\"Iran\",\"IQ\":\"Iraq\",\"IE\":\"Ireland\",\"IM\":\"Isle of Man\",\"IL\":\"Israel\",\"IT\":\"Italy\",\"JM\":\"Jamaica\",\"JP\":\"Japan\",\"JE\":\"Jersey\",\"JO\":\"Jordan\",\"KZ\":\"Kazakhstan\",\"KE\":\"Kenya\",\"KI\":\"Kiribati\",\"KR\":\"Korea\",\"KW\":\"Kuwait\",\"KG\":\"Kyrgyzstan\",\"LA\":\"Laos\",\"LV\":\"Latvia\",\"LB\":\"Lebanon\",\"LS\":\"Lesotho\",\"LR\":\"Liberia\",\"LY\":\"Libya\",\"LI\":\"Liechtenstein\",\"LT\":\"Lithuania\",\"LU\":\"Luxembourg\",\"MO\":\"Macao SAR\",\"MG\":\"Madagascar\",\"MW\":\"Malawi\",\"MY\":\"Malaysia\",\"MV\":\"Maldives\",\"ML\":\"Mali\",\"MT\":\"Malta\",\"MH\":\"Marshall Islands\",\"MQ\":\"Martinique\",\"MR\":\"Mauritania\",\"MU\":\"Mauritius\",\"YT\":\"Mayotte\",\"MX\":\"Mexico\",\"FM\":\"Micronesia\",\"MD\":\"Moldova\",\"MC\":\"Monaco\",\"MN\":\"Mongolia\",\"ME\":\"Montenegro\",\"MS\":\"Montserrat\",\"MA\":\"Morocco\",\"MZ\":\"Mozambique\",\"MM\":\"Myanmar\",\"NA\":\"Namibia\",\"NR\":\"Nauru\",\"NP\":\"Nepal\",\"NL\":\"Netherlands\",\"NC\":\"New Caledonia\",\"NZ\":\"New Zealand\",\"NI\":\"Nicaragua\",\"NE\":\"Niger\",\"NG\":\"Nigeria\",\"NU\":\"Niue\",\"NF\":\"Norfolk Island\",\"KP\":\"North Korea\",\"MK\":\"North Macedonia\",\"MP\":\"Northern Mariana Islands\",\"NO\":\"Norway\",\"OM\":\"Oman\",\"PK\":\"Pakistan\",\"PW\":\"Palau\",\"PS\":\"Palestinian Authority\",\"PA\":\"Panama\",\"PG\":\"Papua New Guinea\",\"PY\":\"Paraguay\",\"PE\":\"Peru\",\"PH\":\"Philippines\",\"PN\":\"Pitcairn Islands\",\"PL\":\"Poland\",\"PT\":\"Portugal\",\"PR\":\"Puerto Rico\",\"QA\":\"Qatar\",\"RE\":\"Réunion\",\"RO\":\"Romania\",\"RU\":\"Russia\",\"RW\":\"Rwanda\",\"BL\":\"Saint Barthélemy\",\"KN\":\"Saint Kitts and Nevis\",\"LC\":\"Saint Lucia\",\"MF\":\"Saint Martin\",\"PM\":\"Saint Pierre and Miquelon\",\"VC\":\"Saint Vincent and the Grenadines\",\"WS\":\"Samoa\",\"SM\":\"San Marino\",\"ST\":\"São Tomé and Príncipe\",\"SA\":\"Saudi Arabia\",\"SN\":\"Senegal\",\"RS\":\"Serbia\",\"SC\":\"Seychelles\",\"SL\":\"Sierra Leone\",\"SG\":\"Singapore\",\"SX\":\"Sint Maarten\",\"SK\":\"Slovakia\",\"SI\":\"Slovenia\",\"SB\":\"Solomon Islands\",\"SO\":\"Somalia\",\"ZA\":\"South Africa\",\"GS\":\"South Georgia and South Sandwich Islands\",\"SS\":\"South Sudan\",\"ES\":\"Spain\",\"LK\":\"Sri Lanka\",\"SH\":\"St Helena, Ascension, Tristan da Cunha\",\"SD\":\"Sudan\",\"SR\":\"Suriname\",\"SJ\":\"Svalbard\",\"SE\":\"Sweden\",\"CH\":\"Switzerland\",\"SY\":\"Syria\",\"TW\":\"Taiwan\",\"TJ\":\"Tajikistan\",\"TZ\":\"Tanzania\",\"TH\":\"Thailand\",\"TL\":\"Timor-Leste\",\"TG\":\"Togo\",\"TK\":\"Tokelau\",\"TO\":\"Tonga\",\"TT\":\"Trinidad and Tobago\",\"TN\":\"Tunisia\",\"TR\":\"Turkey\",\"TM\":\"Turkmenistan\",\"TC\":\"Turks and Caicos Islands\",\"TV\":\"Tuvalu\",\"UM\":\"U.S. Outlying Islands\",\"VI\":\"U.S. Virgin Islands\",\"UG\":\"Uganda\",\"UA\":\"Ukraine\",\"AE\":\"United Arab Emirates\",\"US\":\"United States\",\"UY\":\"Uruguay\",\"UZ\":\"Uzbekistan\",\"VU\":\"Vanuatu\",\"VA\":\"Vatican City\",\"VE\":\"Venezuela\",\"VN\":\"Vietnam\",\"WF\":\"Wallis and Futuna\",\"YE\":\"Yemen\",\"ZM\":\"Zambia\",\"ZW\":\"Zimbabwe\"}"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "country_code_input_placeholder_text",
"Override": false,
"Value": "Country or region"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "country_code_label",
"Override": false,
"Value": "Country Code"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "enter_code_text_intro",
"Override": false,
"Value": "Enter your verification code below, or "
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "error_448",
"Override": false,
"Value": "The phone number you provided is unreachable."
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "error_449",
"Override": false,
"Value": "User has exceeded the number of retry attempts."
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "error_incorrect_code",
"Override": false,
"Value": "The verification code you have entered does not match our records. Please try again, or request a new code."
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "error_tryagain",
"Override": false,
"Value": "The phone number you provided is busy or unavailable. Please check the number and try again."
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "intro_entry_mixed",
"Override": false,
"Value": "Enter a number below that we can send a code via SMS or phone to authenticate you."
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "intro_entry_phone",
"Override": false,
"Value": "Enter a number below that we can phone to authenticate you."
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "intro_entry_sms",
"Override": false,
"Value": "Enter a number below that we can send a code via SMS to authenticate you."
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "intro_mixed",
"Override": false,
"Value": "We have the following number on record for you. We can send a code via SMS or phone to authenticate you."
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "intro_mixed_p",
"Override": false,
"Value": "We have the following numbers on record for you. Choose a number that we can phone or send a code via SMS to authenticate you."
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "intro_phone",
"Override": false,
"Value": "We have the following number on record for you. We will phone to authenticate you."
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "intro_phone_p",
"Override": false,
"Value": "We have the following numbers on record for you. Choose a number that we can phone to authenticate you."
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "intro_sms",
"Override": false,
"Value": "We have the following number on record for you. We will send a code via SMS to authenticate you."
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "intro_sms_p",
"Override": false,
"Value": "We have the following numbers on record for you. Choose a number that we can send a code via SMS to authenticate you."
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "invalid_code",
"Override": false,
"Value": "Please enter the 6 digit code you received"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "invalid_number",
"Override": false,
"Value": "Please enter a valid phone number"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "local_number_input_placeholder_text",
"Override": false,
"Value": "Phone number"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "number_label",
"Override": false,
"Value": "Phone Number"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "number_pattern",
"Override": false,
"Value": "^\\+(?:[0-9][\\x20-]?){6,14}[0-9]$"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "requiredField_code",
"Override": false,
"Value": "Please enter the verification code you received"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "requiredField_countryCode",
"Override": false,
"Value": "Please select your country code"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "requiredField_number",
"Override": false,
"Value": "Please enter your phone number"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "text_button_send_second_code",
"Override": false,
"Value": "send a new code"
},
{
"ElementType": "UxElement",
"ElementId": null,
"StringId": "verification_code_input_placeholder_text",
"Override": false,
"Value": "Verification code"
}
]
}