-
Notifications
You must be signed in to change notification settings - Fork 986
Description
Operating System
macOS 14.1.1
Browser Version
Chrome/120.0.6099.234
Firebase SDK Version
10.7.1
Firebase SDK Product:
Auth
Describe your project's tooling
Traditional Web Development Tools(html, javascript), vite
Describe the problem
During the process of linking accounts, I encountered an issue where, after successfully signing up with the Google account abc@gmail.com, attempting to link this Google account with an existing email/password account (also abc@gmail.com) leads to unexpected behavior. Instead of linking the two accounts, the sdk appears to be treating the operation as a new account creation. The linkWithCredential function, which is expected to send a request to the 'setAccountInfo' endpoint for linking accounts, seems to be sending the request to the 'signupNewUser' endpoint instead.
Steps and code to reproduce issue
Scenario
- Sign up through Google using the account abc@gmail.com.
- Attempt to sign up again using the same email abc@gmail.com, but this time with the email/password authentication method.
- Since the account has already been used for registration, attempt to link the accounts.
- Use linkWithCredential function to link email and password credentials to a user account.
But Internally in the sdk, the linkWithCredential function is sending a link request to the wrong endpoint.
Code snippet
const googleProvider = new GoogleAuthProvider({});
const credential = await signInWithPopup(auth, googleProvider);
const emailCredential = EmailAuthProvider.credential(
'abc@gmail.com',
'123qwe!!',
);
const result = await linkWithCredential(credential.user, emailCredential);
Running the linkWithCredential function sends a request to the "https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=[API_KEY]" endpoint, which is used to create accounts. (not expected)
It sholud sends a request to "https://identitytoolkit.googleapis.com/v1/accounts:update?key=[API_KEY]" (expected)
[rest api doc]
This problem occurs in firebase sdk v10.7.1
I found that sdk v10.0.0 doesn't have this problem.