问题
I'm trying to get authorization code for Google Drive in my ASP program. I wrote some code like quickstart program from sample of Google API for .NET:
private static IAuthorizationState GetAuthorization(NativeApplicationClient arg){
// Get the auth URL:
IAuthorizationState state = new AuthorizationState(
new[] {DriveService.Scopes.Drive.GetStringValue() });
state.Callback = new Uri(NativeApplicationClient.OutOfBandCallbackUrl);
Uri authUri = arg.RequestUserAuthorization(state);
//Request authorization from the user (by opening a browser window):
Process.Start(authUri.ToString());
Console.Write(" Authorization Code: ");
string authCode = Console.ReadLine();
Console.WriteLine();
// Retrieve the access token by using the authorization code:
return arg.ProcessUserAuthorization(authCode, state);
}
I want to get authorization code by opening a popup and user can access permission in this, after user access permission, this return the code.
来源:https://stackoverflow.com/questions/13752727/how-to-authenticate-with-google-drive-in-asp-net-without-copy-pasting-auth-token