Skip to content

Commit 90becb8

Browse files
author
Tomas Bezouska
committed
Use .ConfigureAwait(false) where possible
Resovles #68
1 parent bb7b5cd commit 90becb8

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/Firebase.Auth/FirebaseAuthLink.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public async Task RefreshUserDetails()
5959
{
6060
if (this.AuthProvider != null && !string.IsNullOrEmpty(this.FirebaseToken))
6161
{
62-
this.User = await this.AuthProvider.GetUserAsync(this.FirebaseToken);
62+
this.User = await this.AuthProvider.GetUserAsync(this.FirebaseToken).ConfigureAwait(false);
6363
}
6464
}
6565

src/Firebase.Auth/FirebaseAuthProvider.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public async Task<FirebaseAuthLink> SignInWithCustomTokenAsync(string customToke
4747
{
4848
string content = $"{{\"token\":\"{customToken}\",\"returnSecureToken\":true}}";
4949
FirebaseAuthLink firebaseAuthLink = await this.ExecuteWithPostContentAsync(GoogleCustomAuthUrl, content).ConfigureAwait(false);
50-
firebaseAuthLink.User = await this.GetUserAsync(firebaseAuthLink.FirebaseToken);
50+
firebaseAuthLink.User = await this.GetUserAsync(firebaseAuthLink.FirebaseToken).ConfigureAwait(false);
5151
return firebaseAuthLink;
5252
}
5353

@@ -59,9 +59,9 @@ public async Task<FirebaseAuthLink> SignInWithCustomTokenAsync(string customToke
5959
public async Task<User> GetUserAsync(string firebaseToken)
6060
{
6161
var content = $"{{\"idToken\":\"{firebaseToken}\"}}";
62-
var response = await this.client.PostAsync(new Uri(string.Format(GoogleGetUser, this.authConfig.ApiKey)), new StringContent(content, Encoding.UTF8, "application/json"));
62+
var response = await this.client.PostAsync(new Uri(string.Format(GoogleGetUser, this.authConfig.ApiKey)), new StringContent(content, Encoding.UTF8, "application/json")).ConfigureAwait(false);
6363

64-
JObject resultJson = JObject.Parse(await response.Content.ReadAsStringAsync());
64+
JObject resultJson = JObject.Parse(await response.Content.ReadAsStringAsync().ConfigureAwait(false));
6565
var user = JsonConvert.DeserializeObject<User>(resultJson["users"].First().ToString());
6666
return user;
6767
}
@@ -72,7 +72,7 @@ public async Task<User> GetUserAsync(string firebaseToken)
7272
/// <param name="auth"> The authenticated user to verify email address. </param>
7373
public async Task<User> GetUserAsync(FirebaseAuth auth)
7474
{
75-
return await GetUserAsync(auth.FirebaseToken);
75+
return await this.GetUserAsync(auth.FirebaseToken).ConfigureAwait(false);
7676
}
7777

7878
/// <summary>
@@ -140,7 +140,7 @@ public async Task<FirebaseAuthLink> CreateUserWithEmailAndPasswordAsync(string e
140140
if (sendVerificationEmail)
141141
{
142142
//send verification email
143-
await SendEmailVerificationAsync(signup);
143+
await this.SendEmailVerificationAsync(signup).ConfigureAwait(false);
144144
}
145145

146146
return signup;
@@ -167,8 +167,8 @@ public async Task DeleteUserAsync(string firebaseToken)
167167

168168
try
169169
{
170-
var response = await this.client.PostAsync(new Uri(string.Format(GoogleDeleteUserUrl, this.authConfig.ApiKey)), new StringContent(content, Encoding.UTF8, "application/json"));
171-
responseData = await response.Content.ReadAsStringAsync();
170+
var response = await this.client.PostAsync(new Uri(string.Format(GoogleDeleteUserUrl, this.authConfig.ApiKey)), new StringContent(content, Encoding.UTF8, "application/json")).ConfigureAwait(false);
171+
responseData = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
172172

173173
response.EnsureSuccessStatusCode();
174174
}
@@ -211,7 +211,7 @@ public async Task SendEmailVerificationAsync(string firebaseToken)
211211
/// <param name="auth"> The authenticated user to verify email address. </param>
212212
public async Task SendEmailVerificationAsync(FirebaseAuth auth)
213213
{
214-
await SendEmailVerificationAsync(auth.FirebaseToken);
214+
await this.SendEmailVerificationAsync(auth.FirebaseToken).ConfigureAwait(false);
215215
}
216216

217217
/// <summary>
@@ -237,7 +237,7 @@ public async Task<FirebaseAuthLink> LinkAccountsAsync(string firebaseToken, stri
237237
/// <returns> The <see cref="FirebaseAuthLink"/>. </returns>
238238
public async Task<FirebaseAuthLink> LinkAccountsAsync(FirebaseAuth auth, string email, string password)
239239
{
240-
return await LinkAccountsAsync(auth.FirebaseToken, email, password);
240+
return await this.LinkAccountsAsync(auth.FirebaseToken, email, password).ConfigureAwait(false);
241241
}
242242

243243
/// <summary>
@@ -264,7 +264,7 @@ public async Task<FirebaseAuthLink> LinkAccountsAsync(string firebaseToken, Fire
264264
/// <returns> The <see cref="FirebaseAuthLink"/>. </returns>
265265
public async Task<FirebaseAuthLink> LinkAccountsAsync(FirebaseAuth auth, FirebaseAuthType authType, string oauthAccessToken)
266266
{
267-
return await LinkAccountsAsync(auth.FirebaseToken, authType, oauthAccessToken);
267+
return await this.LinkAccountsAsync(auth.FirebaseToken, authType, oauthAccessToken).ConfigureAwait(false);
268268
}
269269

270270
/// <summary>
@@ -279,8 +279,8 @@ public async Task<ProviderQueryResult> GetLinkedAccountsAsync(string email)
279279

280280
try
281281
{
282-
var response = await this.client.PostAsync(new Uri(string.Format(GoogleCreateAuthUrl, this.authConfig.ApiKey)), new StringContent(content, Encoding.UTF8, "application/json"));
283-
responseData = await response.Content.ReadAsStringAsync();
282+
var response = await this.client.PostAsync(new Uri(string.Format(GoogleCreateAuthUrl, this.authConfig.ApiKey)), new StringContent(content, Encoding.UTF8, "application/json")).ConfigureAwait(false);
283+
responseData = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
284284

285285
response.EnsureSuccessStatusCode();
286286

@@ -302,9 +302,9 @@ public async Task<FirebaseAuthLink> RefreshAuthAsync(FirebaseAuth auth)
302302

303303
try
304304
{
305-
var response = await this.client.PostAsync(new Uri(string.Format(GoogleRefreshAuth, this.authConfig.ApiKey)), new StringContent(content, Encoding.UTF8, "application/json"));
305+
var response = await this.client.PostAsync(new Uri(string.Format(GoogleRefreshAuth, this.authConfig.ApiKey)), new StringContent(content, Encoding.UTF8, "application/json")).ConfigureAwait(false);
306306

307-
responseData = await response.Content.ReadAsStringAsync();
307+
responseData = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
308308
var refreshAuth = JsonConvert.DeserializeObject<RefreshAuth>(responseData);
309309

310310
return new FirebaseAuthLink
@@ -336,8 +336,8 @@ private async Task<FirebaseAuthLink> ExecuteWithPostContentAsync(string googleUr
336336

337337
try
338338
{
339-
var response = await this.client.PostAsync(new Uri(string.Format(googleUrl, this.authConfig.ApiKey)), new StringContent(postContent, Encoding.UTF8, "application/json"));
340-
responseData = await response.Content.ReadAsStringAsync();
339+
var response = await this.client.PostAsync(new Uri(string.Format(googleUrl, this.authConfig.ApiKey)), new StringContent(postContent, Encoding.UTF8, "application/json")).ConfigureAwait(false);
340+
responseData = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
341341

342342
response.EnsureSuccessStatusCode();
343343

0 commit comments

Comments
 (0)