User ID for custom UserData is wrong

I am using the code from the docs to set my customUserData:

func updateUserCustomData() {
	app.login(credentials: Credentials.anonymous) { (result) in
        switch result {
        case .failure(let error):
            print("Failed to log in: \(error.localizedDescription)")
        case .success(let user):
            // Access the custom user document remotely to update it.
            // need to make these constants
            let client = user.mongoClient("mongodb-atlas")
            let database = client.database(named: "AltoProDev0")
            let collection = database.collection(withName: "User")
            collection.updateOneDocument(
                filter: ["userId": AnyBSON(user.id)],

but the user.id is wrong! I have no idea where it is getting the id as I checked the App User and my User table and that ids are the same but different than the user.id referenced in the code… what is going on?

Thank you

1 Like

Stupid… I had used the JWTToken and my code above was from my “anonymous” test which is wrong.
Getting better

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.