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

feat: Parse screenName in ProvidedUserInfo #611

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions auth/user_mgt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

// multiFactorInfoResponse describes the `mfaInfo` of the user record API response
Expand Down
8 changes: 8 additions & 0 deletions auth/user_mgt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ var testUser = &UserRecord{
ProviderID: "phone",
PhoneNumber: "+1234567890",
UID: "testuid",
}, {
ProviderID: "github",
ScreenName: "login",
UID: "testuid",
},
},
TokensValidAfterMillis: 1494364393000,
Expand Down Expand Up @@ -1926,6 +1930,10 @@ func TestMakeExportedUser(t *testing.T) {
ProviderID: "phone",
PhoneNumber: "+1234567890",
UID: "testuid",
}, {
ProviderID: "github",
ScreenName: "login",
UID: "testuid",
}},
MFAInfo: []*multiFactorInfoResponse{
{
Expand Down
5 changes: 5 additions & 0 deletions testdata/get_user.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
"providerId": "phone",
"phoneNumber": "+1234567890",
"rawId": "testuid"
},
{
"providerId": "github",
"screenName": "login",
"rawId": "testuid"
}
],
"photoUrl": "http://www.example.com/testuser/photo.png",
Expand Down
10 changes: 10 additions & 0 deletions testdata/list_users.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
"providerId": "phone",
"phoneNumber": "+1234567890",
"rawId": "testuid"
},
{
"providerId": "github",
"screenName": "login",
"rawId": "testuid"
}
],
"photoUrl": "http://www.example.com/testuser/photo.png",
Expand Down Expand Up @@ -66,6 +71,11 @@
"providerId": "phone",
"phoneNumber": "+1234567890",
"rawId": "testuid"
},
{
"providerId": "github",
"screenName": "login",
"rawId": "testuid"
}
],
"photoUrl": "http://www.example.com/testuser/photo.png",
Expand Down