copio e incollo, non è farina del mio sacco
- - - - - - - - - - - - - -
Per prima cosa, per fare chiamate API REST a Google Firebase, dovrai ottenere un token di accesso da Google. Dopo aver ottenuto un token di accesso, puoi utilizzare il codice seguente per eseguire chiamate API REST a Firebase:
La variabile requestUri dovrebbe essere sostituita con l'URI specifico che si desidera chiamare, ad esempio https://XXXXXXXXX.firebaseio.com/products per recuperare i prodotti.codice:Public Async Function ForStackOverFlow(ByVal requestUri As String) As Task(Of String) requestUri = "https://XXXXXXXXX.firebaseio.com/??????????????" Using client As New HttpClient() Dim URI As Uri = New Uri(requestUri) Dim auth As Byte() = Encoding.ASCII.GetBytes("xxxxutente:xxxxxpassword") client.DefaultRequestHeaders.Authorization = New Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(auth)) Dim response As HttpResponseMessage = Await client.GetAsync(URI) Dim content As HttpContent = response.Content Return Await content.ReadAsStringAsync() End Using End Function
Inoltre, dovrai sostituire xxxxutente:xxxxxpassword con il tuo nome utente e password di Firebase.