I have a website that uses SQL Server on Azure for all of its data. I am working with another company to get additional information for specific records that exist in my database.
When these "specific records" are viewed, I want to provide another link to get this additional information from the Firebase database.
So, I'm trying to write a service that will retrieve this data, here is what I wrote before PoC:
private readonly string firebaseUrl = "https://{myproject}.firebaseio.com/";
private readonly string authToken = "x:xxxxxxxxxxx:xxx:xxxxxxxxxxxxxxxx";
public async Task<IEnumerable<InMatchStat>> GetInMatchStats()
{
try
{
var firebase = new FirebaseClient(firebaseUrl, new FirebaseOptions { AuthTokenAsyncFactory = () => Task.FromResult(authToken) });
var stats = await firebase.Child("my/collection/path").OnceAsync<InMatchStat>();
if (stats == null || !stats.Any())
{
return null;
}
return await Convert(stats.AsEnumerable());
}
catch (Exception exception)
{
var message = exception.ToString();
}
return null;
}
This is the error I return from Firebase when I try to make a call var stats = await firebase.Child()....:
firebase could not parse authentication token
FirebaseDatabase.NET Github: https://github.com/step-up-labs/firebase-database-dotnet
, , , , :
var auth = "ABCDE";
var firebaseClient = new FirebaseClient(
"<URL>",
new FirebaseOptions
{
AuthTokenAsyncFactory = () => Task.FromResult(auth)
});
:
var firebase = new FirebaseClient("https://dinosaur-facts.firebaseio.com/");
var dinos = await firebase
.Child("dinosaurs")
.OrderByKey()
.StartAt("pterodactyl")
.LimitToFirst(2)
.OnceAsync<Dinosaur>();
foreach (var dino in dinos)
{
Console.WriteLine($"{dino.Key} is {dino.Object.Height}m high.");
}
?