2013-06-28 68 views
0

我正嘗試使用Xamarin在Android手機上使用.NET API上傳視頻。我無法驗證,並在主題行中出現錯誤。下面是從Xamarin代碼:我用HttpScoop您必須經過身份驗證才能發出請求 - GoogleAuthenticator

https://github.com/xamarin/google-apis/blob/master/src/Android/Google.Apis.Android/Apis/Authentication/GoogleAuthenticator.cs

而且似乎也沒有網絡流量。

我使用的Web應用程序ID:

客戶端ID爲Web應用程序

客戶端ID:

* .apps.googleusercontent.com

郵箱地址:

* @ developer.gserviceaccount.com

客戶祕密:

- *

重定向的URI:http://jmawebtechnologies.com

JavaScript來源:http://jmawebtechnologies.com

這裏是我創建谷歌身份驗證者:

GoogleAuthenticator Auth() 
{ 
return new Google.Apis.Authentication.OAuth2.GoogleAuthenticator (ClientID, new Uri ("http://jmawebtechnologies.com"),                  Google.Apis.Youtube.v3.YoutubeService.Scopes.YoutubeUpload.ToString()); 
} 
+1

您可以運行提琴手或類似的東西,我們可以看到您發送到服務器的確切請求嗎? – peleyal

+0

我確實運行過它。似乎沒有交通。查看我的新請求圖片。 –

回答

0

我發現我必須調用GetUI。這會打開用戶登錄Google的瀏覽器窗口。

StartActivity(auth2.GetUI (this)); 

        auth2.Completed += (sender, eventArgs) => { 


         if (eventArgs.IsAuthenticated) { 
          MakeAlert("Is auth", "Accepted!"); 
         } else { 
          // The user cancelled 
          MakeAlert("Is not auth", "failure"); 
         } 
        }; 
+0

嘿,你有沒有得到auth2。你能發佈auth2代碼嗎?謝謝 – senzacionale