Open achyut007 opened 7 years ago
Use auth token for login instead email/password https://github.com/egirault/googleplay-api/issues/74
When using the authentication token I get the following error in the login step
So I am asking if the code works fine with you. what is the key/value pairs that you used for the cookies.
I used this repo for generate the auth token https://github.com/yeriomin/token-dispenser
@anton9088 I used the same repo to generate the token. So I have the following questions: 1) the akdeniz's code makes 4 steps (checkin, login, checkin, then login):
- postCheckin
- loginAC2DM
- postCheckin
- login
So can you show a code snippet for the changes that you made to the code (i.e., which step that you bypassed).
Checkin:
public AndroidCheckinResponse checkin() throws Exception {
// this first checkin is for generating android-id
AndroidCheckinResponse checkinResponse = postCheckin(Utils.generateAndroidCheckinRequest(deviceModel, SDK_Version).toByteArray());
this.setAndroidID(BigInteger.valueOf(checkinResponse.getAndroidId()).toString(16));
setSecurityToken((BigInteger.valueOf(checkinResponse.getSecurityToken()).toString(16)));
String c2dmAuth = loginAC2DM();
AndroidCheckinRequest.Builder checkInbuilder = AndroidCheckinRequest.newBuilder(Utils.generateAndroidCheckinRequest(deviceModel, SDK_Version));
AndroidCheckinRequest build = checkInbuilder.setId(new BigInteger(this.getAndroidID(), 16).longValue())
.setSecurityToken(new BigInteger(getSecurityToken(), 16).longValue()).addAccountCookie("[" + getEmail() + "]")
.addAccountCookie(c2dmAuth).build();
// this is the second checkin to match credentials with android-id
return postCheckin(build.toByteArray());
}
Then Login:
/**
* Authenticates on server with given email and password and sets
* authentication token. This token can be used to login instead of using
* email and password every time.
*/
public void login() throws Exception {
HttpEntity responseEntity = executePost(URL_LOGIN, new String[][] { { "Email", this.getEmail() }, { "Passwd", this.password },
{ "service", "androidmarket" }, { "accountType", ACCOUNT_TYPE_HOSTED_OR_GOOGLE }, { "has_permission", "1" },
{ "source", "android" }, { "androidId", this.getAndroidID() }, { "app", "com.android.vending" },
{ "device_country", "us" }, { "lang", "en" }, { "sdk_version", SDK_Version }, }, null);
System.out.println("YYYYYYY Step 2: System could login with ID [" + this.getAndroidID() + "]");
Map<String, String> response = Utils.parseResponse(new String(Utils.readAll(responseEntity.getContent())));
if (response.containsKey("Auth")) {
setToken(response.get("Auth"));
} else {
throw new GooglePlayException("Authentication failed!");
}
}
2) The token-dispenser project has two token generation methods. Did you bypass the two checkin steps and used the checkin token and used the general token for the long step?
I simply use GooglePlayAPI.login(String token) method
Hi, I am getting issue while trying to sign in into google account. I have automated script to download the apk files from Google Play store. The script was running fine till last week. But, recently getting following error related to akdeniz.googleplaycrawler library:
Exception in thread "main" com.akdeniz.googleplaycrawler.GooglePlayException: Error=BadAuthentication at com.akdeniz.googleplaycrawler.GooglePlayAPI.executeHttpRequest(GooglePlayAPI.java:522) at com.akdeniz.googleplaycrawler.GooglePlayAPI.executePost(GooglePlayAPI.java:482) at com.akdeniz.googleplaycrawler.GooglePlayAPI.executePost(GooglePlayAPI.java:462)
and so on... Currently, I am using googleplaycrawler-0.3.jar to download apk files from play store. How can I resolve it? Can you please help me in this issue?
Thank you, Achyut