Skip to content
Youngho Chaa cha cha
TwitterHomepage

AWS Amplify

javascript1 min read

Authentication and Authorization

  • Use toString() when you handle the error and use the error message
try {
const signUpResult = await Auth.signUp({
username: accountDetails.email,
password: accountDetails.password || '',
attributes: {
given_name: accountDetails.firstname,
family_name: accountDetails.lastname,
email: accountDetails.email,
},
})
userId = signUpResult.userSub
} catch (error) {
console.log('error', JSON.stringify(error))
toast.show({
render: () => (
<ToastMessage
type='error'
title='Account creation failed'
description={(error as any).toString()}
/>
),
})
return
}
© 2024 by Youngho Chaa cha cha. All rights reserved.
Theme by LekoArts