AuthProvider: Use actual device properties to generate anonymous auth

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2025-04-07 22:50:00 +08:00
parent 0bca496d6c
commit 3b41525c50
2 changed files with 6 additions and 30 deletions

View File

@@ -1,25 +0,0 @@
/*
* Aurora Store
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
*
* Aurora Store is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Aurora Store is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.aurora.store.data.model
data class Auth(
val email: String,
val auth: String
)

View File

@@ -23,12 +23,10 @@ import android.content.Context
import android.util.Log
import com.aurora.gplayapi.data.models.AuthData
import com.aurora.gplayapi.data.models.PlayResponse
import com.aurora.gplayapi.helpers.AppDetailsHelper
import com.aurora.gplayapi.helpers.AuthHelper
import com.aurora.gplayapi.network.IHttpClient
import com.aurora.store.R
import com.aurora.store.data.model.AccountType
import com.aurora.store.data.model.Auth
import com.aurora.store.util.Preferences
import com.aurora.store.util.Preferences.PREFERENCE_AUTH_DATA
import com.aurora.store.util.Preferences.PREFERENCE_DISPENSER_URLS
@@ -113,15 +111,18 @@ class AuthProvider @Inject constructor(
suspend fun buildAnonymousAuthData(): Result<AuthData> {
return withContext(Dispatchers.IO) {
try {
val playResponse = httpClient.getAuth(dispenserURL!!).also {
val playResponse = httpClient.postAuth(
dispenserURL!!,
gson.toJson(spoofProvider.deviceProperties).toByteArray()
).also {
if (!it.isSuccessful) throwError(it, context)
}
val auth = gson.fromJson(String(playResponse.responseBytes), Auth::class.java)
val auth = gson.fromJson(String(playResponse.responseBytes), AuthData::class.java)
return@withContext Result.success(
AuthHelper.build(
email = auth.email,
token = auth.auth,
token = auth.authToken,
tokenType = AuthHelper.Token.AUTH,
isAnonymous = true,
properties = spoofProvider.deviceProperties,