Skip to content

Commit 19b6d8c

Browse files
authored
Auth: Correctly include email scope in auth request (#2938)
1 parent b847d73 commit 19b6d8c

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

play-services-base/core/src/main/java/org/microg/gms/auth/AuthRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public AuthRequest oauth2IncludeProfile(String oauth2IncludeProfile) {
233233
return this;
234234
}
235235

236-
public AuthRequest oauth2IncludeEmail(String oauth2IncludeProfile) {
236+
public AuthRequest oauth2IncludeEmail(String oauth2IncludeEmail) {
237237
this.oauth2IncludeEmail = oauth2IncludeEmail;
238238
return this;
239239
}

play-services-core/src/main/kotlin/org/microg/gms/auth/credentials/identity/IdentitySignInService.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@ class IdentitySignInServiceImpl(private val context: Context, private val client
8181
}
8282
val bundle = Bundle().apply {
8383
val options = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
84+
.requestEmail()
8485
.requestIdToken(request.googleIdTokenRequestOptions.serverClientId).build()
8586
putByteArray(BEGIN_SIGN_IN_REQUEST, SafeParcelableSerializer.serializeToBytes(request))
8687
putByteArray(GOOGLE_SIGN_IN_OPTIONS, SafeParcelableSerializer.serializeToBytes(options))
8788
putString(CLIENT_PACKAGE_NAME, clientPackageName)
8889
requestMap[request.sessionId] = options
8990
}
90-
callback.onResult(Status.SUCCESS, BeginSignInResult(performGooogleSignIn(bundle)))
91+
callback.onResult(Status.SUCCESS, BeginSignInResult(performGoogleSignIn(bundle)))
9192
} else if (request.passkeyJsonRequestOptions.isSupported) {
9293
fun JSONObject.getArrayOrNull(key: String) = if (has(key)) getJSONArray(key) else null
9394
fun <T> JSONArray.map(fn: (JSONObject) -> T): List<T> = (0 until length()).map { fn(getJSONObject(it)) }
@@ -143,14 +144,16 @@ class IdentitySignInServiceImpl(private val context: Context, private val client
143144
}
144145
val bundle = Bundle().apply {
145146
val options =
146-
GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestIdToken(request.serverClientId)
147+
GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
148+
.requestEmail()
149+
.requestIdToken(request.serverClientId)
147150
.build()
148151
putByteArray(GET_SIGN_IN_INTENT_REQUEST, SafeParcelableSerializer.serializeToBytes(request))
149152
putByteArray(GOOGLE_SIGN_IN_OPTIONS, SafeParcelableSerializer.serializeToBytes(options))
150153
putString(CLIENT_PACKAGE_NAME, clientPackageName)
151154
requestMap[request.sessionId] = options
152155
}
153-
callback.onResult(Status.SUCCESS, performGooogleSignIn(bundle))
156+
callback.onResult(Status.SUCCESS, performGoogleSignIn(bundle))
154157
}
155158

156159
override fun getPhoneNumberHintIntent(
@@ -160,7 +163,7 @@ class IdentitySignInServiceImpl(private val context: Context, private val client
160163
callback.onResult(Status.CANCELED, null)
161164
}
162165

163-
private fun performGooogleSignIn(bundle: Bundle): PendingIntent {
166+
private fun performGoogleSignIn(bundle: Bundle): PendingIntent {
164167
val intent = Intent(ACTION_ASSISTED_SIGN_IN).apply {
165168
`package` = context.packageName
166169
putExtras(bundle)

0 commit comments

Comments
 (0)