firebase / firebase-admin-go

Firebase Admin Go SDK
Apache License 2.0
1.14k stars 247 forks source link

FR: Parse screenName from ProvidedUserInfo #610

Open sixstone-qq opened 5 months ago

sixstone-qq commented 5 months ago

Describe your environment

Describe the problem

Steps to reproduce:

When a user is logged in using GitHub as provider it returns the screenName aka login in GitHub when requesting this information via accounts.lookup in ProvidedUserInfo as described in https://cloud.google.com/identity-platform/docs/reference/rest/v1/ProviderUserInfo

Relevant Code:

Missing ScreenName field from auth.UserInfo struct to parse it into memory.

--- a/auth/user_mgt.go
+++ b/auth/user_mgt.go
@@ -59,6 +59,9 @@ type UserInfo struct {
        // In UserRecord.UserInfo it will return the constant string "firebase".
        ProviderID string `json:"providerId,omitempty"`
        UID        string `json:"rawId,omitempty"`
+       // ScreenName is the user's screen name at Twitter or login name at GitHub.
+       // Only populated in ProviderUserInfo[]
+       ScreenName string `json:"screenName,omitempty"`
 }