Google Contacts Data Api を使用して、こちらのドキュメントに従ってすべてのユーザーの連絡先を取得していますhttps://developers.google.com/google-apps/contacts/v3/
最初に、Google Auth を使用して、次のコードを使用してアプリケーションに対してユーザーを認証しました
string authSubUrl = AuthSubUtil.getRequestUrl("http://localhost:62439/ContactImporter/GoogleContacts.aspx", "https://www.google.com/m8/feeds/", true, true);
Response.Redirect(authSubUrl);
ユーザーが正常にログインしてから2番目に、Googleから提供されたリクエストトークンを使用してGoogleContacts.aspxページにリダイレクトし、次のコードで連絡先を取得しようとしています
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);
}
}
}
そのコードは約4または5日から機能していましたが、現在は機能しておらず、次のエラーが表示されます
リモート サーバーがエラーを返しました: (401) 権限がありません。Google.GData.Client.GDataRequest.Execute() で Google.GData.Client.GDataGAuthRequest.Execute(Int32 retryCounter) で Google.GData.Client.GDataGAuthRequest.Execute() で Google.GData.Client.Service.Query(Uri Google.GData.Client.Service.Query(Uri queryUri, DateTime ifModifiedSince) の Google.GData.Client.Service.Query(FeedQuery feedQuery) の 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 、オブジェクト o、オブジェクト t、EventArgs e) で System.Web.Util.CalliEventHandlerDelegateProxy.Callback(オブジェクト送信者、EventArgs e) で System.Web.UI.Control.OnLoad(EventArgs e) で System.Web.UI.Control. System.Web.UI.Page.ProcessRequestMain の LoadRecursive() (ブール値 includeStagesBeforeAsyncPoint、ブール値 includeStagesAfterAsyncPoint)
そのエラーを解決する方法について何か提案はありますか?