简体   繁体   English

getIdToken 和 getAppCheckToken 有什么区别?

[英]What is difference between the getIdToken and getAppCheckToken?

Currently firebase has introduce the App Check.目前firebase已经引入了App Check。 To protect the non firebase backend firebase has introduce getAppCheckToken.为了保护非 firebase 后端 firebase 引入了 getAppCheckToken。 Previously we are using the getIdToken to verify the user.以前我们使用 getIdToken 来验证用户。

 FirebaseAuth.getInstance().currentUser.getIdToken(true).addOnSuccessListener {
    Log.d("tag",it.token) // token #1
}

FirebaseAppCheck.getInstance()
        .getAppCheckToken(false)
        .addOnSuccessListener { tokenResponse ->
    Log.d("tag",tokenResponse) // token #1
}

What's difference between both this two token.这两个令牌有什么区别。 How getAppCheckToken can improve the security of the non firebase backend. getAppCheckToken 如何提高非 firebase 后端的安全性。

Basically the difference between getIdToken and getAppCheckToken is:基本上getIdTokengetAppCheckToken之间的区别是:

FirebaseAuth.getInstance().currentUser.getIdToken(true){}

Fetches a Firebase Auth ID Token for the user;为用户获取 Firebase Auth ID Token; useful when authenticating against your own backend, if forceRefresh == true, thrown if the current user's account has been disabled, deleted, or its credentials are no longer valid.在针对您自己的后端进行身份验证时很有用,如果 forceRefresh == true,则在当前用户的帐户已被禁用、删除或其凭据不再有效时抛出。

FirebaseAppCheck.getInstance().getAppCheckToken(true){}

Requests a Firebase App Check token.请求 Firebase 应用检查令牌。 This method should be used ONLY if you need to authorize requests to a non-Firebase backend.仅当您需要授权对非 Firebase 后端的请求时才应使用此方法。 Requests to Firebase backends are authorized automatically if configured.如果已配置,对 Firebase 后端的请求将自动获得授权。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Cloud Build 和 Cloud Deploy 有什么区别? - What is the difference between Cloud Build and Cloud Deploy? GCP 云作曲家和工作流有什么区别? - What is the difference between GCP cloud composer and workflow? Uvicorn 和 Gunicorn+Uvicorn 有什么区别? - What is the difference between Uvicorn and Gunicorn+Uvicorn? AWS Amplify 中的 currentAuthenticatedUser() 和 currentUserPoolUser() 有什么区别? - what is difference between currentAuthenticatedUser() and currentUserPoolUser() in AWS Amplify? Ballerina 中的 final 和 const 有什么区别? - What is the difference between final and const in Ballerina? Amazon SNS 和 Amazon SQS 有什么区别? - What is the difference between Amazon SNS and Amazon SQS? Auth.currentAuthenticatedUser() 和 Auth.currentSession() 有什么区别? - What is the difference between Auth.currentAuthenticatedUser() and Auth.currentSession()? boto3 中的 terminate_instances() 和 terminate() 有什么区别? - What is the difference between terminate_instances() and terminate() in boto3? Go 中的数据竞争和条件有什么区别? - What's the difference between Data Race and Condition in Go? AWS Billing and Cost Management 和 AWS cost explorer 之间有什么区别? - What is the difference between AWS Billing and Cost Management and AWS cost explorer?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM