com.google.gdata.client.GoogleService$CaptchaRequiredException

发布于 2024-12-02 13:15:21 字数 3444 浏览 1 评论 0原文

我在执行 gdata api 示例代码时遇到以下错误。我是 api 新手。请让我知道同样的决议。我需要在哪里放置验证码以及如何放置。

严重:身份验证错误:需要验证码 com.google.gdata.client.GoogleService$CaptchaRequiredException: 需要验证码的位置为 com.google.gdata.client.GoogleAuthTokenFactory.getAuthException(GoogleAuthTokenFactory.java:623) 在 com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:500) 在 com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:346) 在 com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:362) 在 com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:317) 在 com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:301) 在 com.google.gdata.client.appsforyourdomain.audit.AuditService。(AuditService.java:77) 在 AuditSampleClient.main(AuditSampleClient.java:100)

import java.util.Calendar;
import java.util.Properties;

import com.google.gdata.client.appsforyourdomain.audit.AuditService;
import com.google.gdata.client.appsforyourdomain.audit.MailBoxDumpRequest;
import com.google.gdata.data.TextConstruct;
import com.google.gdata.data.appsforyourdomain.AppsForYourDomainException;
import com.google.gdata.data.appsforyourdomain.generic.GenericEntry;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;

public class google_data {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub

            export_data();
    }
    public static void export_data()
    {
        MailBoxDumpRequest request = new MailBoxDumpRequest();
        request.setAdminEmailAddress("-----");
        request.setUserEmailAddress("----------");

        Calendar beginDate = Calendar.getInstance();
        beginDate.set(2011, Calendar.AUGUST, 1, 4, 30);
        request.setBeginDate(beginDate.getTime());

        Calendar endDate = Calendar.getInstance();
        endDate.set(2011, Calendar.AUGUST, 30, 20, 0);
        request.setEndDate(endDate.getTime());

        request.setIncludeDeleted(true);
        request.setSearchQuery("in:chat");
        request.setPackageContent("FULL_MESSAGE");

        AuditService service = null;
        try {
            service = new AuditService("-----", "------", "------", "-------auditapp-v1");
        } catch (AuthenticationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        GenericEntry mailboxDumpEntry = null;
        try {
            mailboxDumpEntry = service.createMailboxDumpRequest(request);
        } catch (AppsForYourDomainException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ServiceException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        TextConstruct requestId = mailboxDumpEntry.getSummary();
        System.out.println(requestId.toString());
        //String status = mailboxDumpEntry.getStatus();
        //String numberOfFiles = mailboxDumpEntry.getNumberOfFiles();
    }

}

I am getting below error while executing the gdata api sample code. I am new to the api . Please let me know the resolution for the same. Where i need to to put the captcha and how.

SEVERE: Authentication Error: Captcha required
com.google.gdata.client.GoogleService$CaptchaRequiredException:
Captcha required at
com.google.gdata.client.GoogleAuthTokenFactory.getAuthException(GoogleAuthTokenFactory.java:623)
at
com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:500)
at
com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:346)
at
com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:362)
at
com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:317)
at
com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:301)
at
com.google.gdata.client.appsforyourdomain.audit.AuditService.(AuditService.java:77)
at AuditSampleClient.main(AuditSampleClient.java:100)

import java.util.Calendar;
import java.util.Properties;

import com.google.gdata.client.appsforyourdomain.audit.AuditService;
import com.google.gdata.client.appsforyourdomain.audit.MailBoxDumpRequest;
import com.google.gdata.data.TextConstruct;
import com.google.gdata.data.appsforyourdomain.AppsForYourDomainException;
import com.google.gdata.data.appsforyourdomain.generic.GenericEntry;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;

public class google_data {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub

            export_data();
    }
    public static void export_data()
    {
        MailBoxDumpRequest request = new MailBoxDumpRequest();
        request.setAdminEmailAddress("-----");
        request.setUserEmailAddress("----------");

        Calendar beginDate = Calendar.getInstance();
        beginDate.set(2011, Calendar.AUGUST, 1, 4, 30);
        request.setBeginDate(beginDate.getTime());

        Calendar endDate = Calendar.getInstance();
        endDate.set(2011, Calendar.AUGUST, 30, 20, 0);
        request.setEndDate(endDate.getTime());

        request.setIncludeDeleted(true);
        request.setSearchQuery("in:chat");
        request.setPackageContent("FULL_MESSAGE");

        AuditService service = null;
        try {
            service = new AuditService("-----", "------", "------", "-------auditapp-v1");
        } catch (AuthenticationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        GenericEntry mailboxDumpEntry = null;
        try {
            mailboxDumpEntry = service.createMailboxDumpRequest(request);
        } catch (AppsForYourDomainException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ServiceException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        TextConstruct requestId = mailboxDumpEntry.getSummary();
        System.out.println(requestId.toString());
        //String status = mailboxDumpEntry.getStatus();
        //String numberOfFiles = mailboxDumpEntry.getNumberOfFiles();
    }

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

讽刺将军 2024-12-09 13:15:21

顾名思义,该服务要求用户先解决验证码,然后才能再次使用自动登录。

例外情况应包含相关验证码的 URL。来自客户端登录用户指南:

来自 ClientLogin 的失败响应包含错误代码和可向用户显示的错误页面的 URL。如果错误代码是 CAPTCHA 质询,则响应还包括 CAPTCHA 图像的 URL 和特殊令牌。您的应用程序应该能够请求用户回答,然后重试登录请求。

该网址可通过 getCaptchaUrl() 方法。

It means exactly what it says - the service requires the user to solve a CAPTCHA before you can use an automated login again.

The exception should include a URL for the relevant CAPTCHA. From the client login user guide:

A failure response from ClientLogin contains an error code and a URL to an error page that can be displayed to the user. If the error code is a CAPTCHA challenge, the response also includes a URL to a CAPTCHA image and a special token. Your application should be able to solicit an answer from the user and then retry the login request.

The URL is available through the getCaptchaUrl() method.

傾旎 2024-12-09 13:15:21

我得到了解决方案:

http://code.google.com/googleapps/faq.html# Handlingcaptcha

为什么我在解锁管理员帐户后仍然收到验证码错误?

Please verify in your code that you are specifying your full administrator email address e.g. "[email protected]" instead of just "admin".

I got the solution:

http://code.google.com/googleapps/faq.html#handlingcaptcha

Why do I keep getting CAPTCHA errors even after I unlock the administrator account?

Please verify in your code that you are specifying your full administrator email address e.g. "[email protected]" instead of just "admin".
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文