Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(46)

Unified Diff: Src/GoogleApis.Auth.WP/OAuth2/GoogleWebAuthorizationBroker.cs

Issue 94340043: Issue 463: Provide a signout\logout method (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Patch Set: Gus' comments Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Src/GoogleApis.Auth.WP/OAuth2/GoogleWebAuthorizationBroker.cs
===================================================================
--- a/Src/GoogleApis.Auth.WP/OAuth2/GoogleWebAuthorizationBroker.cs
b/Src/GoogleApis.Auth.WP/OAuth2/GoogleWebAuthorizationBroker.cs
@@ -75,6 75,23 @@
return await AuthorizeAsyncCore(initializer, scopes, user, taskCancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Asynchronously reauthorizes the user. This method should be called if the users want to authorize after
/// they revoked the token.
/// </summary>
/// <param name="userCredential">The current user credential. Its <see cref="UserCredential.Token"/> will be
/// updated. </param>
/// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param>
public static async Task ReauthorizeAsync(UserCredential userCredential,
CancellationToken taskCancellationToken)
{
var installedApp = new AuthorizationCodeWPInstalledApp(userCredential.Flow);
// Create an authorization code installed app instance and authorize the user.
UserCredential newUserCredential = await installedApp.AuthorizeAsync(userCredential.UderId,
taskCancellationToken).ConfigureAwait(false);
userCredential.Token = newUserCredential.Token;
}
/// <summary>The core logic for asynchronously authorizing the specified user.</summary>
/// <param name="initializer">The authorization code initializer.</param>
/// <param name="scopes">
@@ -83,13 100,14 @@
/// <param name="user">The user to authenticate.</param>
/// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param>
/// <returns>User credential.</returns>
- private static async Task<UserCredential> AuthorizeAsyncCore(AuthorizationCodeFlow.Initializer initializer,
- IEnumerable<string> scopes, string user, CancellationToken taskCancellationToken)
private static async Task<UserCredential> AuthorizeAsyncCore(
GoogleAuthorizationCodeFlow.Initializer initializer, IEnumerable<string> scopes, string user,
CancellationToken taskCancellationToken)
{
initializer.Scopes = scopes;
initializer.DataStore = new StorageDataStore();
- var installedApp = new AuthorizationCodeWPInstalledApp(initializer);
var installedApp = new AuthorizationCodeWPInstalledApp(new GoogleAuthorizationCodeFlow(initializer));
return await installedApp.AuthorizeAsync(user, taskCancellationToken).ConfigureAwait(false);
}
}

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b