#✅ - Auth.SignUp custom attributes in Swift?

1 messages · Page 1 of 1 (latest)

bronze ore
#

I'm trying to replicate custom attributes on SignUp in an iOS app using Swift. I get the following:

An error occurred while registering a user AuthError: Attributes did not conform to the schema: custom:groupName: Attribute does not exist in the schema.

This is the JavaScript code:

    const { user } = await Auth.signUp({
      username,
      password,
      attributes: {
        email,          // optional
        phone_number,   // optional - E.164 number convention
        // other custom attributes 
      },
      autoSignIn: { // optional - enables auto sign in after user is confirmed
        enabled: true,
      }
bronze ore
#

I got it worked out...

let updateResult = try await Amplify.Auth.update(
                  userAttribute: **AuthUserAttribute(.custom("groupName"), value: "groupName")**
              )
              switch updateResult.nextStep {
              case .confirmAttributeWithCode(let deliveryDetails, let info):
                  print("Confirm the attribute with details send to - \(deliveryDetails) \(String(describing: info))")
              case .done:
                  print("Update completed")
              }
steady coyote
#

Great, thanks for letting us know!

lone ibexBOT
#

✅ - Auth.SignUp custom attributes in Swift?