<metro>Google的验证
我前阵子做Google drive的开发。由于不熟悉Windows8所以很费时间。但我发现一例验证方法很好。那就是Google的方法。首先注册开通Google Drive API的开发模式,接着打开Visual Studio12,在其中用一个Button控件,选择Click事件。填入一下代码就好了。
private async void Start_Click(object sender, RoutedEventArgs e) { String GoogleURL = "https://accounts.google.com/o/oauth2/auth?client_id=" + Uri.EscapeDataString("1027748717521.apps.googleusercontent.com") + "&redirect_uri=" + Uri.EscapeDataString("urn:ietf:wg:oauth:2.0:oob") + "&response_type=code&scope=" + Uri.EscapeDataString("https://www.googleapis.com/auth/drive.file"); System.Uri StartUri = new Uri(GoogleURL); System.Uri EndUri = new Uri("urn:ietf:wg:oauth:2.0:oob"); WebAuthenticationResult WebAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.UseTitle, StartUri, EndUri); }