Skip to content

MFA UpdateUser fails with "Illegal trailing data" when EnrollmentTimestamp is set #764

@deresmos

Description

@deresmos

Environment

  • firebase-admin-go: v4.20.0

Problem

Calling UpdateUser with an MFA factor whose EnrollmentTimestamp is non-zero fails with:

{
  "error": {
    "code": 400,
    "message": "Invalid value at 'mfa.enrollments[0].enrolled_at' (type.googleapis.com/google.protobuf.Timestamp), Field 'enrolledAt', Invalid time format: Illegal trailing data in input string",
    "errors": [
      {
        "message": "Invalid value at 'mfa.enrollments[0].enrolled_at' (type.googleapis.com/google.protobuf.Timestamp), Field 'enrolledAt', Invalid time format: Illegal trailing data in input string",
        "reason": "invalid"
      }
    ],
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "field": "mfa.enrollments[0].enrolled_at",
            "description": "Invalid value at 'mfa.enrollments[0].enrolled_at' (type.googleapis.com/google.protobuf.Timestamp), Field 'enrolledAt', Invalid time format: Illegal trailing data in input string"
          }
        ]
      }
    ]
  }
}

Reproduction

user := (&auth.UserToUpdate{}).MFASettings(auth.MultiFactorSettings{
    EnrolledFactors: []*auth.MultiFactorInfo{
        {
            UID:                 "someuid",
            DisplayName:         "My phone",
            FactorID:            "phone",
            EnrollmentTimestamp: time.Now().Unix() * 1000,
            Phone:               &auth.PhoneMultiFactorInfo{PhoneNumber: "+11234567890"},
        },
    },
})

_, err := client.UpdateUser(ctx, "someuid", user)
// err: "Illegal trailing data in input string"

Setting EnrollmentTimestamp to 0 avoids the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions