Sto usando Google Contacts Data API per ottenere tutti i contatti dell'utente in seguito alla documentazione qui https://developers.google.com/google-apps/contacts/v3/Google Contacts Data API 401 errore
prima ho usato Google Auth per autenticare gli utenti per l'applicazione utilizzando il seguente codice
string authSubUrl = AuthSubUtil.getRequestUrl("http://localhost:62439/ContactImporter/GoogleContacts.aspx", "https://www.google.com/m8/feeds/", true, true);
Response.Redirect(authSubUrl);
secondi dopo che l'utente loged con successo in rioriento alla pagina GoogleContacts.aspx con richiesta di token forniti da Google e poi cercando di ottenere i contatti dal seguente codice
if (!string.IsNullOrEmpty(Request["token"]))
{
GAuthSubRequestFactory authFactory = new GAuthSubRequestFactory("cp", "alpha");
RequestSettings rs = new Google.GData.Client.RequestSettings("alpha",Request["token"]);
ContactsRequest cr = new ContactsRequest(rs);
Feed<Contact> f = cr.GetContacts();
foreach (Contact entry in f.Entries)
{
foreach (EMail email in entry.Emails)
{
Response.Write("\n" + email.Address);
}
}
}
che il codice stava lavorando da circa 4 o 5 giorni, ma ora il suo non funziona e mi ottiene il seguente errore
The remote server returned an error: (401) Unauthorized. at Google.GData.Client.GDataRequest.Execute() at Google.GData.Client.GDataGAuthRequest.Execute(Int32 retryCounter) at Google.GData.Client.GDataGAuthRequest.Execute() at Google.GData.Client.Service.Query(Uri queryUri, DateTime ifModifiedSince, String etag, Int64& contentLength) at Google.GData.Client.Service.Query(Uri queryUri, DateTime ifModifiedSince) at Google.GData.Client.Service.Query(FeedQuery feedQuery) at Google.GData.Client.Feed
1.get_AtomFeed() at Google.GData.Client.Feed
1.d__0.MoveNext() at GoogleContacts.Page_Load(Object sender, EventArgs e) in d:\Working Folder\API's\ContactImporter\GoogleContacts.aspx.cs:line 25 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Tutti i suggerimenti su come risolvere tale errore?
http://code.google.com/apis/contacts/docs/3.0/developers_guide.html pagina non trovata –
Un argomento è stato avviato nei forum di google: [qui] (http://productforums.google.com/forum/#! argomento/gmail/-qeBgCFsRhs). Forse google risponderà alle nostre domande ... – Max
qualsiasi soluzione finale con l'esempio di codice sorgente completo a lavorare su di esso? – Kiquenet