Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Firebase Auth/Import Users: a phone number field is missing in a user identity provider struct #540

Open
mymyparty opened this issue Mar 14, 2023 · 0 comments

Comments

@mymyparty
Copy link

mymyparty commented Mar 14, 2023

Environment

  • Operating System version: macOS 13.2.1
  • Firebase SDK version: Firebase Admin SDK v4
  • Library version: v4.10.0
  • Firebase Product: auth

A problem

We actively use Firebase Auth in a new project.
Some tools and services are written in Go.
We want to migrate existing users to Firebase.
So we use Firebase Auth's Import Users feature.
Almost all works well, but it is hard to test some cases because some info is missing in the docs.
That is why being looking through the Firebase Auth docs for other programming languages (https://firebase.google.com/docs/reference/admin/node/firebase-admin.auth.userproviderrequest.md#properties)
we figured out that a phoneNumber field is missing in the auth.UserProvider struct in Go version of the sdk.

Reproduce

Just take a look at Node.js' docs https://firebase.google.com/docs/reference/admin/node/firebase-admin.auth.userproviderrequest.md#properties
and at source codes of Go version

type UserProvider struct {

Relevant Code

The UserProvider struct should have all the fields that Node.js version has:

type UserProvider struct {
	UID         string `json:"rawId"`
	ProviderID  string `json:"providerId"`
	Email       string `json:"email,omitempty"`
	PhoneNumber string `json:"phoneNumber,omitempty"` // missing field in current version
	DisplayName string `json:"displayName,omitempty"`
	PhotoURL    string `json:"photoUrl,omitempty"`
}

A use case:

	if p.Phone != nil {
		providers = append(providers, &auth.UserProvider{
			UID:         p.ID.String(),
			ProviderID:  ProviderPhone,
			PhoneNumber: *p.Phone,
			DisplayName: displayName,
		})
	}

A main idea is the same fields should be used across all the implementations of the Firebase Admin API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants