Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 502f91e

Browse files
feat: Parse screenName in ProvidedUserInfo
This is available when having multiple providers where it provides a screen name such as Twitter or GitHub. See https://cloud.google.com/identity-platform/docs/reference/rest/v1/ProviderUserInfo for details. It's available at endpoints like accounts.lookup or projects.queryAccounts Signed-off-by: Enrique J. Hernández <sixstone-qq@users.noreply.github.com>
1 parent 6a28190 commit 502f91e

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

‎auth/user_mgt.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ type UserInfo struct {
5959
// In UserRecord.UserInfo it will return the constant string "firebase".
6060
ProviderID string `json:"providerId,omitempty"`
6161
UID string `json:"rawId,omitempty"`
62+
// ScreenName is the user's screen name at Twitter or login name at GitHub.
63+
// Only populated in ProviderUserInfo[]
64+
ScreenName string `json:"screenName,omitempty"`
6265
}
6366

6467
// multiFactorInfoResponse describes the `mfaInfo` of the user record API response

‎auth/user_mgt_test.go‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ var testUser = &UserRecord{
5757
ProviderID: "phone",
5858
PhoneNumber: "+1234567890",
5959
UID: "testuid",
60+
}, {
61+
ProviderID: "github",
62+
ScreenName: "login",
63+
UID: "testuid",
6064
},
6165
},
6266
TokensValidAfterMillis: 1494364393000,
@@ -1926,6 +1930,10 @@ func TestMakeExportedUser(t *testing.T) {
19261930
ProviderID: "phone",
19271931
PhoneNumber: "+1234567890",
19281932
UID: "testuid",
1933+
}, {
1934+
ProviderID: "github",
1935+
ScreenName: "login",
1936+
UID: "testuid",
19291937
}},
19301938
MFAInfo: []*multiFactorInfoResponse{
19311939
{

‎testdata/get_user.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
"providerId": "phone",
2121
"phoneNumber": "+1234567890",
2222
"rawId": "testuid"
23+
},
24+
{
25+
"providerId": "github",
26+
"screenName": "login",
27+
"rawId": "testuid"
2328
}
2429
],
2530
"photoUrl": "http://www.example.com/testuser/photo.png",

‎testdata/list_users.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
"providerId": "phone",
2121
"phoneNumber": "+1234567890",
2222
"rawId": "testuid"
23+
},
24+
{
25+
"providerId": "github",
26+
"screenName": "login",
27+
"rawId": "testuid"
2328
}
2429
],
2530
"photoUrl": "http://www.example.com/testuser/photo.png",
@@ -66,6 +71,11 @@
6671
"providerId": "phone",
6772
"phoneNumber": "+1234567890",
6873
"rawId": "testuid"
74+
},
75+
{
76+
"providerId": "github",
77+
"screenName": "login",
78+
"rawId": "testuid"
6979
}
7080
],
7181
"photoUrl": "http://www.example.com/testuser/photo.png",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /