[英]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:基本上getIdToken和getAppCheckToken之间的区别是:
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.