Create User
In Amity SDK, creating a new user can be done through the login method. Once the user account has been created, the user can then log into the app using their userId and displayName using the SDK's social and chat features.
You may need to create a new user account via the SDK, such as when integrating the SDK with an existing user authentication system. In these cases, you can use the login method. Here's how the login method works:
If a user already exists for the specified
userId, the SDK will log the user into the app using the provideduserId. ThedisplayNameparameter can be updated upon calling theloginmethod. If thedisplayNameparameter is not provided, the system will retain the existing user'sdisplayName.If a user account does not already exist for the specified
userId, the SDK will automatically create a new user account with the provideddisplayNameand log the user into the app. IfdisplayNameis not provided, theuserIdwill be used asdisplayName.
import AmityClient from “@amityco/js-sdk”
const amityClient = new AmityClient({ apiKey, apiEndpoint })
amityClient.registerSession({ userId, displayName, avatarFileId })Version 6 and Beta(v0.0.1)
Last updated
Was this helpful?