@Deprecated public class ClientLoginTokens extends Object
ClientLoginTokens clientLoginTokens = new ClientLoginTokens.Builder()
.forApi(ClientLoginTokens.Api.ADWORDS)
.fromFile()
.build();
String clientLoginToken = clientLoginTokens.requestToken();
If you receive a CAPTCHA challenge you can supply the login token and captcha
in the requestToken function like:
String clientLoginToken;
try {
clientLoginToken = clientLoginTokens.requestToken();
} catch(ClientLoginException e) {
if (e.getCaptchaInfo != null) {
String loginCaptcha =
// redirect user to e.getCaptchaInfo.getCaptchaUrl() to get CAPTCHA;
String loginToken = captchaInformation.getCaptchaToken();
clientLoginToken =
clientLoginTokens.requestToken(loginCaptcha, loginToken);
}
}
Modifier and Type | Class and Description |
---|---|
static class |
ClientLoginTokens.Api
Deprecated.
Enum representing the API that ClientLoginTokens can be used for.
|
static class |
ClientLoginTokens.Builder
Deprecated.
Pre-builder for ClientLoginTokens.
|
static class |
ClientLoginTokens.ForApiBuilder
Deprecated.
Builder for ClientLoginTokens.
|
Modifier and Type | Method and Description |
---|---|
String |
getToken()
Deprecated.
Checks to see if we can use an existing clientLoginToken from file,
otherwise delegates to
requestToken() . |
String |
requestToken()
Deprecated.
Requests a token with the email and password.
|
String |
requestToken(String captchaToken,
String captchaAnswer)
Deprecated.
Requests a token with the email and password, along with information used
to validate a CAPTCHA'ed account.
|
public String requestToken(String captchaToken, String captchaAnswer) throws com.google.api.client.googleapis.auth.clientlogin.ClientLoginResponseException, IOException
captchaToken
- the CAPTCHA token. i.e.
.ClientLogin.ErrorInfo#captchaToken ErrorInfo#captchaToken
captchaAnswer
- the CAPTCHA answer. i.e. fetched from
.ClientLogin.ErrorInfo#captchaUrl ErrorInfo#captchaUrl
com.google.api.client.googleapis.auth.clientlogin.ClientLoginResponseException
- if the token could not be retrievedIOException
- if there was a problem making the requestpublic String getToken() throws com.google.api.client.googleapis.auth.clientlogin.ClientLoginResponseException, IOException
requestToken()
.com.google.api.client.googleapis.auth.clientlogin.ClientLoginResponseException
- if the token could not be retrieved,
possibly due to a CAPTCHA
challengeIOException
- if there was a problem making the requestpublic String requestToken() throws com.google.api.client.googleapis.auth.clientlogin.ClientLoginResponseException, IOException
com.google.api.client.googleapis.auth.clientlogin.ClientLoginResponseException
- if the token could not be retrieved, possibly
due to a CAPTCHA
challengeIOException
- if there was a problem making the requestCopyright © 2014. All Rights Reserved.