Applies to: Workforce tenants External tenants (learn more)
In native authentication, the information you collect from the user during sign-up is configured in the user flow in the Microsoft Entra admin center. The name of the user attribute as it appears in the Microsoft Entra admin center is different from the variable name that you use when you reference it in your app.
Fortunately, the native authentication SDK enables you to build the user attributes and assign values to them before you use them in the SDKs signUp() method.
Use the utility class UserAttribute.Builder that the SDK provides. The UserAttributes.Builder class contains methods whose parameter is the value that you collect from the user.
Identify the user attributes that you want to build, then use the following code snippet to build them:
Kotlin
//build the user attributes, both built-in and custom attributesval userAttributes = UserAttributes.Builder()
.country(country)
.city(city)
.displayName(displayName)
.givenName(givenName)
.jobTitle(jobTitle)
.postalCode(postalCode)
.state(state)
.streetAddress(streetAddress)
.surname(surname)
.build()
CoroutineScope(Dispatchers.Main).launch {
//use the userAttributes variable in your signUp method val actionResult = authAuthClientInstance.signUp(
username = emailAddress,
attributes = userAttributes
)
}
To build custom attributes, use UserAttribute.Builder class customAttribute() method. The method accepts the custom attribute's programmable name, and the value of the attribute:
Kotlin
val userAttributes = UserAttributes.Builder()
.customAttribute("extension_2588abcdwhtfeehjjeeqwertc_loyaltyNumber", loyaltyNumber)
.build()
CoroutineScope(Dispatchers.Main).launch {
//use the userAttributes variable in your signUp method val actionResult = authAuthClientInstance.signUp(
username = emailAddress,
attributes = userAttributes
)
}
To build user attributes in the iOS/macOS MSAL SDK:
Identify the user attributes that you want to build, then create a dictionary variable, where:
the key is the programmable name of the user attribute, as a string. The programmable name can be for built-in or custom attribute.
the value in the value of the user attribute that you collect from the user.
Identify the user attributes that you want to build, then use the following code snippet to build them:
To build custom attributes, use UserAttribute.Builder class customAttribute() method. The method accepts the custom attribute's programmable name, and the value of the attribute:
Descubra cómo Id. externa de Microsoft Entra puede proporcionar experiencias de inicio de sesión seguras y sin problemas para los consumidores y clientes empresariales. Explore la creación de inquilinos, el registro de aplicaciones, la personalización de flujo y la seguridad de la cuenta.
Muestre las características de Microsoft Entra ID para modernizar las soluciones de identidad, implementar soluciones híbridas e implementar la gobernanza de identidades.
Obtenga información sobre cómo usar las API de autenticación nativas para autenticar a los usuarios en las aplicaciones orientadas al cliente con el inquilino externo.
Obtenga información sobre cómo configurar la autenticación nativa en el identificador externo de Microsoft Entra. Personalice la interfaz de usuario para aplicaciones móviles y de escritorio y proporcione una experiencia de inicio de sesión sin problemas.
Obtenga información sobre cómo añadir el registro mediante un código de acceso de un solo uso o correo electrónico y contraseña, y recopilar atributos de usuario en una aplicación móvil Android mediante la autenticación nativa.
Obtenga información sobre cómo implementar la reserva web en una aplicación iOS/macOS mediante la autenticación nativa para garantizar la estabilidad en el flujo de autenticación.
Aprenda a agregar el inicio de sesión y el cierre de sesión con el código de acceso de un solo uso de correo electrónico o el nombre de usuario y la contraseña en una aplicación de Android mediante la autenticación nativa.