// INIT FIREBASE
FirebaseOptions options = new FirebaseOptions.Builder()
.setServiceAccount(new FileInputStream("C:\\path\\testcustom-dff2147d3b14.json"))
.setDatabaseUrl("https://testcustom-a1a4d.firebaseio.com/")
.build();
FirebaseApp.initializeApp(options);
isFireBaseInit = true;
// GENERATE TOKEN
String uid = "USER ID SOME RANDOM";
HashMap<String, Object> additionalClaims = new HashMap<String, Object>();
String token = FirebaseAuth.getInstance().createCustomToken(uid, additionalClaims);
若我嘗試使用REST API我獲得以下錯誤來獲取數據火力休息與權威性查詢參數不是從瀏覽器工作
:
{
"error" : "Missing claim 'kid' in auth header."
}
什麼我做錯了嗎?
自定義令牌不能與rest api一起使用。 我需要使用firebase link,如果是的話如何添加額外的索賠呢?
PS:我使用
com.google.firebase 火力服務器-SDK 3.0.1
編輯 火力SDK版本:有一個在火力文件a不一致性
FIREBASE GUIDE DOCUMENTATION SAYS
The argument can either be your Firebase app's secret or an authentication token, as described in the "Users in Firebase Projects"
描述類型的認證是https://firebase.google.com/docs/auth/users#auth_tokens
注:自定義標記存在有
火力REFERENCE文檔說
The argument can either be your Firebase app's secret or an authentication token. See the REST authentication documentation for details.
所以指南和參考說法不同。
需要幫助,請