i use this code to get data from firebase database
B4X:
Dim job1 As HttpJob
job1.Initialize("FiBaDb_read", Me)
job1.Tag = strJobTag
job1.Download(strFiBaDbRoot & strPath & ".json" & "?auth=" & Main.strFirebaseSignedInUserToken)
this work with android with B4I i get this error
ResponseError: unknown error, status code: 401
i get token with this code
B4X:
Private Sub GetTokenfn As String
Dim no As NativeObject
Dim token As NativeObject = no.Initialize("FIRInstanceID").RunMethod("instanceID", Null).RunMethod("token", Null)
If token.IsInitialized Then Return token.AsString Else Return ""
End Sub
Can you post the B4A code that works? it's the same code
only difference GetToken method
Notes
-I think receive a 401 HTTP status code, mean Server key is not valid
-I am able to use and test firebaseauth with same ios project
app let a user log in with firebase auth, then it will connect to a realtime database with REST API
Notes :
-to use realtime database with REST API you need token
-now I connect using same ios app with realtime database using database secret (this is like a fixed token, the problem is this method well deprecated)
-the problem as I explained before is token,firebase refuse token with 401 HTTP status code,
in firebase according to their documentation :
401 HTTP status code, mean Server key is not valid.
Notes :
-REST API just need token (no username or password)
-as I explained (I connect using same ios app code with realtime database using database secret (this is like a fixed token, the problem in this method it well well deprecated)