{"record":{"id":"49f603fc9bd08370","repo":"microg/GmsCore","slug":"integrityerrorcode-api-not-available","errorCode":"IntegrityErrorCode.API_NOT_AVAILABLE","errorMessage":"Not allowed visit","messagePattern":"Not allowed visit","errorType":"error_code","errorClass":"StandardIntegrityException","httpStatus":null,"severity":"error","filePath":"vending-app/src/main/kotlin/com/google/android/finsky/expressintegrityservice/ExpressIntegrityService.kt","lineNumber":275,"sourceCode":"                val exception = it as? StandardIntegrityException ?: StandardIntegrityException(it.message)\n                Log.w(TAG, \"warm up has failed: code=${exception.code}, message=${exception.message}\", exception)\n                visitData?.updateAppIntegrityContent(context, System.currentTimeMillis(), \"$TAG visited failed. ${exception.message}\")\n                callback?.onWarmResult(bundleOf(KEY_ERROR to exception.code))\n            }\n        }\n    }\n\n    override fun requestExpressIntegrityToken(bundle: Bundle, callback: IExpressIntegrityServiceCallback?) {\n        Log.d(TAG, \"requestExpressIntegrityToken bundle:$bundle\")\n        lifecycleScope.launchWhenCreated {\n            runCatching {\n                val callingPackageName = bundle.getString(KEY_PACKAGE_NAME)\n                if (callingPackageName == null) {\n                    throw StandardIntegrityException(IntegrityErrorCode.INTERNAL_ERROR, \"Null packageName.\")\n                }\n                visitData = callerAppToIntegrityData(context, callingPackageName)\n                if (visitData?.allowed != true) {\n                    throw StandardIntegrityException(IntegrityErrorCode.API_NOT_AVAILABLE, \"Not allowed visit\")\n                }\n                val playIntegrityEnabled = VendingPreferences.isDeviceAttestationEnabled(context)\n                if (!playIntegrityEnabled) {\n                    throw StandardIntegrityException(IntegrityErrorCode.API_NOT_AVAILABLE, \"API is disabled\")\n                }\n\n                val expressIntegritySession = ExpressIntegritySession(\n                    packageName = callingPackageName,\n                    cloudProjectNumber = bundle.getLong(KEY_CLOUD_PROJECT, 0L),\n                    sessionId = Random.nextLong(),\n                    requestHash = bundle.getString(KEY_NONCE),\n                    originatingWarmUpSessionId = bundle.getLong(KEY_WARM_UP_SID, 0),\n                    verdictOptOut = bundle.getIntegerArrayList(KEY_REQUEST_VERDICT_OPT_OUT),\n                    webViewRequestMode = bundle.getInt(KEY_REQUEST_MODE, 0)\n                )\n\n                Log.d(TAG, \"requestExpressIntegrityToken session:$expressIntegritySession}\")\n","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/vending-app/src/main/kotlin/com/google/android/finsky/expressintegrityservice/ExpressIntegrityService.kt#L257-L293","documentation":"requestExpressIntegrityToken throws StandardIntegrityException with IntegrityErrorCode.API_NOT_AVAILABLE and message 'Not allowed visit' when callerAppToIntegrityData reports the calling app is not allowed to use the express integrity API. The service gates access per-caller and rejects unauthorized packages.","triggerScenarios":"Calling requestExpressIntegrityToken from a package whose callerAppToIntegrityData result has allowed != true (not on the allowlist or flagged by policy).","commonSituations":"App not allowlisted for express integrity on this device/account; sideloaded or repackaged APK with a different signature; policy server denies the caller.","solutions":["Confirm the app's package name and signing key are registered/allowed for express integrity","Install the app from an approved distribution channel (Play Store)","Check server-side allowlist configuration for the package","Fall back to the standard Integrity API if express access is not granted"],"exampleFix":"// before\nintegrityManager.requestExpressIntegrityToken(bundle, callback)\n// after\nif (isExpressIntegrityAllowed(context)) {\n    integrityManager.requestExpressIntegrityToken(bundle, callback)\n} else {\n    // fall back to standard integrity token flow\n}","handlingStrategy":"fallback","validationCode":"// check caller eligibility hints: distribution channel + signature\nval isFromPlay = context.packageManager.getInstallerPackageName(context.packageName) == \"com.android.vending\"","typeGuard":null,"tryCatchPattern":"try {\n    integrityManager.requestExpressIntegrityToken(bundle, callback)\n} catch (e: StandardIntegrityException) {\n    if (e.statusCode == IntegrityErrorCode.API_NOT_AVAILABLE) {\n        // fall back to standard Integrity API\n    }\n}","preventionTips":["Distribute only through approved channels (Play Store)","Keep signing keys registered with Play App Signing","Design a fallback to the standard integrity token flow"],"tags":["kotlin","play-integrity","access-denied","allowlist"],"backgroundTag":"permission-denied","analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}