firebase / firebase/firebase-js-sdk

FR: Make `getRedirectResult(auth)._tokenResponse` public to get firstName and lastName with Apple signup

Open
#6,754 0 comments 1 reaction 0 assignees View on GitHub
api: auth feature request
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### [REQUIRED] Describe your environment

* Operating System version: any
* Browser version: any
* Firebase SDK version: 9.12.1
* Firebase Product: auth

### [REQUIRED] Describe the problem

When using Apple as a federated provider, there is no way to obtain `firstName` and `lastName`. We need both separated and cannot work just with `displayName`. While debugging we realised that with the following code we are able to obtain these attributes:

```javascript
const res = await getRedirectResult(auth)
const {firstName, lastName} = res._tokenResponse
```

But since `_tokenResponse` is clearly a private thing, we are a bit hesitant to use it (but will anyway for now. :-)).

Either make `_tokenResponse` a publicly available property or add `firstName` and `lastName` to the result of `getAdditionalUserInfo(redirect_result)`.

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.