Managing Mobile App User Accounts with User Identities Learn how to use Seam user identities to manage mobile app user accounts.
What is a User Identity?
Seam user identities are a feature for tracking and managing user accounts in your application. This feature assigns unique identifiers to each of your users, enabling you to issue and manage their mobile credentials and access permissions. Each user identity is mapped to a user account in your app.
User Identities Can Be Connected to Users in Multiple Access Control Systems
User identities can be linked to one ACS user in each access control system. Any mobile credentials issued to these ACS users are consolidated under the user identity. Consequently, a user's mobile app account has access to these credentials through the user identity.
Create a User Identity and Associate it with an ACS User
1. Create a User Identity
To create a user identity , you can specify any of the following characteristics:
Unique user identity key (user_identity_key
)
Unique email address (email_address
)
Unique phone number (phone_number
)
Note that if you specify one or more of the user_identity_key
, email_address
, or phone_number
, each of these values must be unique within your workspace .
Python cURL (bash) Go
Request:
Copy seam . user_identities . create (
user_identity_key = "jean_doe" ,
email_address = "jean@example.com" ,
phone_number = "+15555550110" ,
full_name = "Jean Doe"
)
Response:
Copy UserIdentity"(user_identity_id='48500a8e-5e7e-4bde-b7e5-0be97cae5d7a',
user_identity_key='jean_doe',
email_address='jean@example.com',
phone_number='+15555550110',
display_name='Jean Doe',
full_name='Jean Doe',
created_at='2024-01-11T05:37:50.264Z',
workspace_id='398d80b7-3f96-47c2-b85a-6f8ba21d07be')
Request:
Copy curl -X 'POST' \
'https://connect.getseam.com/user_identities/create' \
-H 'accept: application/json' \
-H 'Authorization: Bearer ${API_KEY}' \
-H 'Content-Type: application/json' \
-d '{
"user_identity_key": "jean_doe",
"email_address": "jean@example.com",
"phone_number": "+15555550110",
"full_name": "Jean Doe"
}'
Response:
Copy {
"user_identity" : {
"user_identity_id" : "48500a8e-5e7e-4bde-b7e5-0be97cae5d7a" ,
"user_identity_key" : "jean_doe" ,
"email_address" : "jean@example.com" ,
"phone_number" : "+15555550110" ,
"display_name" : "Jean Doe" ,
"full_name" : "Jean Doe" ,
"created_at" : "2024-01-11T05:37:50.264Z" ,
"workspace_id" : "398d80b7-3f96-47c2-b85a-6f8ba21d07be"
} ,
"ok" : true
}
Request:
Copy userIdentity, uErr := client.UserIdentities. Create (context. Background (), & useridentities . UserIdentitiesCreateRequest {
UserIdentityKey: api. String ( "jenny_lee" ),
EmailAddress: api. String ( "jenny@example.com" ),
PhoneNumber: api. String ( "+15555550111" ),
FullName: api. String ( "Jenny Lee" ),
})
if uErr != nil {
return uErr
}
fmt. Println (userIdentity)
return nil
Response:
Copy {
"user_identity_id" : "48500a8e-5e7e-4bde-b7e5-0be97cae5d7a" ,
"user_identity_key" : "jean_doe" ,
"email_address" : "jean@example.com" ,
"phone_number" : "+15555550110" ,
"display_name" : "Jean Doe" ,
"full_name" : "Jean Doe" ,
"created_at" : "2024-01-11T05:37:50.264Z" ,
"workspace_id" : "398d80b7-3f96-47c2-b85a-6f8ba21d07be"
}
2. Assign an ACS User to the User Identity
To link an ACS user with a user identity , provide the ID of the user identity and the ID of the ACS user.
Python cURL (bash) Go
Request:
Copy user_identity = seam . user_identities . get (email_address = "jean@example.com" )
acs_user = seam . acs . users . get (email_address = "jean@example.com" )
seam . user_identities . add_acs_user (
user_identity_id = user_identity.user_identity_id,
acs_user_id = acs_user.acs_user_id
)
Response:
Request:
Copy curl -X 'POST' \
'https://connect.getseam.com/user_identities/add_acs_user' \
-H 'accept: application/json' \
-H 'Authorization: Bearer ${API_KEY}' \
-H 'Content-Type: application/json' \
-d '{
"user_identity_id": "48500a8e-5e7e-4bde-b7e5-0be97cae5d7a",
"acs_user_id": "4d223973-0874-4831-8630-bfcb29e6bce0"
}'
Response:
Request:
Copy _, uErr := client.UserIdentities. AddAcsUser (context. Background (), & useridentities . UserIdentitiesAddAcsUserRequest {
UserIdentityId: "48500a8e-5e7e-4bde-b7e5-0be97cae5d7a" ,
AcsUserId: "4d223973-0874-4831-8630-bfcb29e6bce0" ,
})
if uErr != nil {
return uErr
}
return nil
Response: