realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.6k stars 558 forks source link

Calling `User#linkCredentials` with the email of a non-existing user or wrong password never surface error #6586

Closed kraenhansen closed 3 weeks ago

kraenhansen commented 3 weeks ago

How frequently does the bug occur?

Always

Description

When a request failed with a 401, we would try to refresh the session and retry unconditionally, in the case of a link credentials request, this heuristic is too simple as it resulted in an endless loop of session refreshes instead of surfacing the error to the user.

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

async function handleLinking() {
  const user = await app.logIn(Credentials.anonymous());
  const emailPasswordCredentials = Credentials.emailPassword("unknown@example.com", "v3rys3cur3"); // This user doesn't exist or the password is incorrect
  await user.linkCredentials(emailPasswordCredentials);
}

Version

2.0.0

What services are you using?

Atlas App Services: Functions or GraphQL or DataAPI etc

Are you using encryption?

No

Platform OS and version(s)

N/A

Build environment

No response

Cocoapods version

No response

sync-by-unito[bot] commented 3 weeks ago

➤ PM Bot commented:

Jira ticket: RJS-2789