firebase / firebase/firebase-js-sdk

Add a custom UID to the signInWithCredential method

Open
#7,663 0 comments 1 reaction 0 assignees View on GitHub
api: auth needs-attention question stack:React
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### Operating System

MAC

### Browser Version

Chrome

### Firebase SDK Version

11.0.0

### Firebase SDK Product:

Auth, Firestore

### Describe your project's tooling

React app with Ionic

### Describe the problem

In a React app, when we call the signInWithCredential method from the Firebase library, a new user gets created in the Firebase console if it doesn't exist. When this happens, we need to be able to pass a custom UID to this method. The issue is that the createUser method is not available for this React Firebase library, just for the firebase-admin SDK and moving the logic to the backend is not an option at the moment. Any suggestions on how to pass a custom UID to the firebase auth object?

### Steps and code to reproduce issue

```
return await signInWithCredential(auth, credentials)
.then((res) => res.user)
.catch((e) => {
if (!e?.message?.includes('auth/code-expired')) {
errorCallback(e.message);
}
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.