[go: nahoru, domu]

Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(158)
Unified Diff: Src/GoogleApis.Auth.WinRT/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, 1 month 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.WinRT/OAuth2/GoogleWebAuthorizationBroker.cs
===================================================================
--- a/Src/GoogleApis.Auth.WinRT/OAuth2/GoogleWebAuthorizationBroker.cs
+++ b/Src/GoogleApis.Auth.WinRT/OAuth2/GoogleWebAuthorizationBroker.cs
@@ -69,10 +69,27 @@
DataStore = new StroageDataStore()
};
- var installedApp = new AuthorizationCodeWinRTInstalledApp(initializer);
+ var installedApp = new AuthorizationCodeWinRTInstalledApp(new GoogleAuthorizationCodeFlow(initializer));
return await installedApp.AuthorizeAsync(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 AuthorizationCodeWinRTInstalledApp(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>Loads the client secrets from the given URI.</summary>
/// <param name="clientSecretsUri">The client secrets URI.</param>
/// <returns>Client secrets.</returns>
« no previous file with comments | « Src/GoogleApis.Auth.WinRT/OAuth2/AuthorizationCodeWinRTInstalledApp.cs ('k') | Src/GoogleApis.Auth/GoogleApis.Auth.csproj » ('j') | no next file with comments »

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