I am making a React Native app. I have been implementing Anonymous Login when user enters the app. After certain action, user can signup. When I try to link the current anonymous user with email and password, it says [StitchServiceError: invalid username/password]. I don't know why. I have been following the exact same documentation to linkWithCredential.
Here is my code:
const auth = Stitch.defaultAppClient.auth;
const collection = Stitch.defaultAppClient
.getServiceClient(RemoteMongoClient.factory, 'mongodb-atlas')
.db('snack')
.collection('users');
const {email, password, ...rest} = currentUser;
return from(
auth.user.linkWithCredential(
new UserPasswordCredential(email, password),
),
).pipe(switchMap(() => .....))
I am using Redux Observable for side effects.
I have enabled Email/Password and Anonymous Authentication in the settings. I don't know what is wrong here and why is it giving me username and password error when I am trying to signup and link the user.