|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.api.ads.common.lib.auth.ClientLoginTokens
public class ClientLoginTokens
ClientLogin token provider.
Example usage:
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);
}
}
| Nested Class Summary | |
|---|---|
static class |
ClientLoginTokens.Api
Enum representing the API that ClientLoginTokens can be used for. |
static class |
ClientLoginTokens.Builder
Pre-builder for ClientLoginTokens. |
static class |
ClientLoginTokens.ForApiBuilder
Builder for ClientLoginTokens. |
| Field Summary | |
|---|---|
static String |
ADWORDS_SERVICE
Deprecated. Use ClientLoginTokens.Api.ADWORDS in Builder#forApi(Api). |
static String |
DFP_SERVICE
Deprecated. Use ClientLoginTokens.Api.DFP in Builder#forApi(Api). |
| Constructor Summary | |
|---|---|
ClientLoginTokens(String service)
Deprecated. Use new ClientLoginTokens.Builder() instead |
|
| Method Summary | |
|---|---|
String |
from(org.apache.commons.configuration.Configuration config)
Deprecated. Use new ClientTokens.Builder().forApi(Api.ADWORDS)
.from(config) instead. |
String |
from(String email,
String password)
Deprecated. Use new ClientTokens.Builder().forApi(Api.ADWORDS)
.withEmailAndPassword(email, password) instead. |
String |
from(String email,
String password,
String loginToken,
String loginCaptcha)
Deprecated. Use new ClientTokens.Builder()
.forApi(Api.ADWORDS)
.withEmailAndPassword(email, password)
.withLoginTokenAndCaptcha(loginToken,
loginCaptcha) instead. |
String |
fromFile()
Deprecated. Use new ClientTokens.Builder().forApi(Api.ADWORDS)
.fromFile() instead. |
String |
fromFile(File path)
Deprecated. Use new ClientTokens.Builder().forApi(Api.ADWORDS)
.fromFile(path) instead. |
String |
fromFile(String path)
Deprecated. Use new ClientTokens.Builder().forApi(Api.ADWORDS)
.fromFile(path) instead. |
String |
fromFile(URL path)
Deprecated. Use new ClientTokens.Builder().forApi(Api.ADWORDS)
.fromFile(path) instead. |
String |
requestToken()
Requests a token with the email and password. |
String |
requestToken(String captchaToken,
String captchaAnswer)
Requests a token with the email and password, along with information used to validate a CAPTCHA'ed account. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@Deprecated public static final String ADWORDS_SERVICE
ClientLoginTokens.Api.ADWORDS in Builder#forApi(Api).
@Deprecated public static final String DFP_SERVICE
ClientLoginTokens.Api.DFP in Builder#forApi(Api).
| Constructor Detail |
|---|
@Deprecated public ClientLoginTokens(String service)
new ClientLoginTokens.Builder() instead
service - the service name i.e. gam or adwords| Method Detail |
|---|
@Deprecated
public String fromFile()
throws ClientLoginException,
com.google.api.ads.common.lib.conf.ConfigurationLoadException
new ClientTokens.Builder().forApi(Api.ADWORDS)
.fromFile() instead.
com.google.api.ads.common.lib.conf.ConfigurationLoadException - if the configuration could not be
loaded.
ClientLoginException
@Deprecated
public String fromFile(String path)
throws ClientLoginException,
com.google.api.ads.common.lib.conf.ConfigurationLoadException
new ClientTokens.Builder().forApi(Api.ADWORDS)
.fromFile(path) instead.
path - the path to try first as a resource, then as a file
com.google.api.ads.common.lib.conf.ConfigurationLoadException - if the configuration could not be
loaded.
ClientLoginException
@Deprecated
public String fromFile(File path)
throws ClientLoginException,
com.google.api.ads.common.lib.conf.ConfigurationLoadException
new ClientTokens.Builder().forApi(Api.ADWORDS)
.fromFile(path) instead.
path - the path to load properties from
com.google.api.ads.common.lib.conf.ConfigurationLoadException - if the configuration could not be
loaded.
ClientLoginException
@Deprecated
public String fromFile(URL path)
throws ClientLoginException,
com.google.api.ads.common.lib.conf.ConfigurationLoadException
new ClientTokens.Builder().forApi(Api.ADWORDS)
.fromFile(path) instead.
path - the path to try first as a resource, then as a file
com.google.api.ads.common.lib.conf.ConfigurationLoadException - if the configuration could not be
loaded.
ClientLoginException
@Deprecated
public String from(org.apache.commons.configuration.Configuration config)
throws ClientLoginException
new ClientTokens.Builder().forApi(Api.ADWORDS)
.from(config) instead.
api.adwords.clientLoginToken
config -
ClientLoginException
@Deprecated
public String from(String email,
String password)
throws ClientLoginException
new ClientTokens.Builder().forApi(Api.ADWORDS)
.withEmailAndPassword(email, password) instead.
email - the email to fetch the token forpassword - the password to fetch the token for
ClientLoginException - if the token could not be generated
@Deprecated
public String from(String email,
String password,
String loginToken,
String loginCaptcha)
throws ClientLoginException
new ClientTokens.Builder()
.forApi(Api.ADWORDS)
.withEmailAndPassword(email, password)
.withLoginTokenAndCaptcha(loginToken,
loginCaptcha) instead.
email - the email to fetch the token forpassword - the password to fetch the token forloginToken - the login token. Can be null if not needed.loginCaptcha - the login CAPTCHA. Can be null if not needed.
ClientLoginException - if the token could not be generated
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#captchaTokencaptchaAnswer - 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 retrieved
IOException - if there was a problem making the request
public 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
challenge
IOException - if there was a problem making the request
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||