我正在从 android 运行以下代码来获取 AppCheck 令牌。但是,我遇到了一个错误。
FirebaseAppCheck.getInstance()
.getAppCheckToken(true)
.addOnSuccessListener(new OnSuccessListener<AppCheckToken>() {
@Override
public void onSuccess(@NonNull AppCheckToken tokenResponse) {
String appCheckToken = tokenResponse.getToken();
new FirebaseAPIFunction(appCheckToken).execute();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
e.printStackTrace();
}
});
这是我收到的错误。
W/System.err: com.google.firebase.FirebaseException: Error returned from API. code: 403 body: App attestation failed.
W/System.err: at com.google.firebase.appcheck.internal.NetworkClient.exchangeAttestationForAppCheckToken(NetworkClient.java:177)
W/System.err: at com.google.firebase.appcheck.safetynet.internal.SafetyNetAppCheckProvider.lambda$exchangeSafetyNetAttestationResponseForToken$1$SafetyNetAppCheckProvider(SafetyNetAppCheckProvider.java:186)
W/System.err: at com.google.firebase.appcheck.safetynet.internal.-$$Lambda$SafetyNetAppCheckProvider$B6GhOWtZfyrWKLfSayghedQVnKQ.call(Unknown Source:4)
W/System.err: at com.google.android.gms.tasks.zzv.run(Unknown Source:2)
W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/System.err: at java.lang.Thread.run(Thread.java:920)
在为 Android 设置 App Attestation 时,我在此信息下的 Google Play 商店控制台中使用了 SHA 256 密钥。
从客户那里解决这个问题的最佳方法是什么?