@@ -85,6 +85,15 @@ internal static async Task GetUserByPhoneNumberAsync(string phoneNumber)
85
85
// [END get_user_by_phone]
86
86
}
87
87
88
+ internal static async Task GetUserByProviderUidAsync ( )
89
+ {
90
+ // [START get_user_by_federated_id]
91
+ UserRecord userRecord = await FirebaseAuth . DefaultInstance . GetUserByProviderUidAsync ( "google.com" , "google_uid1234" ) ;
92
+ // See the UserRecord reference doc for the contents of userRecord.
93
+ Console . WriteLine ( $ "Successfully fetched user data: { userRecord . Uid } ") ;
94
+ // [END get_user_by_federated_id]
95
+ }
96
+
88
97
internal static async Task CreateUserAsync ( )
89
98
{
90
99
// [START create_user]
@@ -139,6 +148,40 @@ internal static async Task UpdateUserAsync(string uid)
139
148
// [END update_user]
140
149
}
141
150
151
+ internal static async Task UpdateUserFederatedAsync ( string uid )
152
+ {
153
+ // [START update_user_link_federated]
154
+ // Link the user with a federated identity provider (like Google).
155
+ UserRecordArgs args = new UserRecordArgs ( )
156
+ {
157
+ Uid = uid ,
158
+ ProviderToLink = new ProviderUserInfo ( )
159
+ {
160
+ ProviderId = "google.com" ,
161
+ Uid = "google_uid1234" ,
162
+ } ,
163
+ } ;
164
+ UserRecord userRecord = await FirebaseAuth . DefaultInstance . UpdateUserAsync ( args ) ;
165
+ // See the UserRecord reference doc for the contents of userRecord.
166
+ Console . WriteLine ( $ "Successfully updated user: { userRecord . Uid } ") ;
167
+ // [END update_user_link_federated]
168
+
169
+ // [START update_user_unlink_federated]
170
+ // Unlink the user from a federated identity provider (like Google).
171
+ UserRecordArgs args = new UserRecordArgs ( )
172
+ {
173
+ Uid = uid ,
174
+ ProvidersToDelete = new List < string > ( )
175
+ {
176
+ "google.com" ,
177
+ } ,
178
+ } ;
179
+ UserRecord userRecord = await FirebaseAuth . DefaultInstance . UpdateUserAsync ( args ) ;
180
+ // See the UserRecord reference doc for the contents of userRecord.
181
+ Console . WriteLine ( $ "Successfully updated user: { userRecord . Uid } ") ;
182
+ // [END update_user_unlink_federated]
183
+ }
184
+
142
185
internal static async Task DeleteUserAsync ( string uid )
143
186
{
144
187
// [START delete_user]
0 commit comments