Revert "AuthProvider: Use actual device properties to generate anonymous auth"

This reverts commit 3b41525c50.
This commit is contained in:
Aayush Gupta
2025-04-13 18:32:26 +08:00
parent 32bdf3026c
commit 5003f66fff
2 changed files with 30 additions and 6 deletions

View File

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