in authentication/src/main/kotlin/com/uber/sdk2/auth/internal/sso/UniversalSsoLink.kt [63:96]
override suspend fun execute(optionalQueryParams: Map<String, String>): String {
val uri =
UriConfig.assembleUri(
ssoConfig.clientId,
RESPONSE_TYPE,
ssoConfig.redirectUri,
scopes = ssoConfig.scope,
)
.buildUpon()
.also { builder ->
optionalQueryParams.entries.forEach { entry ->
builder.appendQueryParameter(entry.key, entry.value)
}
}
.build()
withContext(Dispatchers.Main) {
when (authContext.authDestination) {
is AuthDestination.CrossAppSso -> {
val packageName =
appDiscovering.findAppForSso(uri, authContext.authDestination.appPriority)
packageName?.let {
val intent = Intent()
intent.`package` = packageName
intent.data = uri
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
intent.putExtra(CALLING_PACKAGE, activity.packageName)
activity.startActivity(intent)
} ?: loadCustomtab(getSecureWebviewUri(uri))
}
is AuthDestination.InApp -> loadCustomtab(getSecureWebviewUri(uri))
}
}
return resultDeferred.await()
}