public class LoginApi
extends java.lang.Object
NOTE: use ClientFactory
to avoid getting CAPTCHAs.
Constructor and Description |
---|
LoginApi(ClientProvider cp,
RequestContextProvider rcp) |
LoginApi(org.apache.hc.client5.http.classic.HttpClient client,
org.apache.hc.core5.http.Header... headers)
Convenience constructor that wraps client in a
DefaultClientProvider and headers in a
DefaultRequestContextProvider . |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
encryptPassword(java.lang.String uid,
char[] pwd)
Convert a plain password to an encrypted password
|
long |
getGsfId() |
java.util.Locale |
getLocale() |
int |
getSdk() |
AuthenticatedUser |
requestSignIn(java.lang.String uid,
java.lang.String epwd,
Captcha captcha,
boolean created)
Sign into Play.
|
void |
setGsfId(long gsfId) |
void |
setLocale(java.util.Locale locale) |
void |
setSdk(int sdk) |
public LoginApi(org.apache.hc.client5.http.classic.HttpClient client, org.apache.hc.core5.http.Header... headers)
DefaultClientProvider
and headers in a
DefaultRequestContextProvider
.client
- client for making requests.headers
- headers to add when making a request.public LoginApi(ClientProvider cp, RequestContextProvider rcp)
cp
- rcp
- public java.util.Locale getLocale()
public void setLocale(java.util.Locale locale)
locale
- public int getSdk()
public void setSdk(int sdk)
public long getGsfId()
public void setGsfId(long gsfId)
public AuthenticatedUser requestSignIn(java.lang.String uid, java.lang.String epwd, Captcha captcha, boolean created) throws java.io.IOException, BadAuthenticationException, CaptchaException, ClientLoginDisabledException
uid
- username (typically an email address=.epwd
- encrypted password.captcha
- solved captcha or null if no captcha required.created
- true if the account has just been created and the server should
include user core data (full name, allowed services, email
address) in the reply.java.io.IOException
BadAuthenticationException
CaptchaException
ClientLoginDisabledException
public static java.lang.String encryptPassword(java.lang.String uid, char[] pwd)
uid
- username (typically a gmail address)pwd
- plain text password (don't forget to zero it after this method
returns).requestSignIn(String, String, Captcha, boolean)
.