I think your code looks a bit weird. When calling GetAccounts, you don’t need to specify the url of the server. The result will be an IEnumerable of all your local accounts. Then you can ToList() to enumerate them.
If what you are looking for is your “default” account. You can always use the GetDefaultAccount.
Here’s an image of how we are getting those on one of the nodes of the Grasshopper Connector.
In your case you are calling GetAccounts().FirstOrDefault(), which can return null if there is no first nor default to return (meaning, the list may be empty?).
So,
first ensure that your Speckle Manager app has at least one account properly set up.
Then, try you code but just remove the input on GetAccounts(). To be honest, That should have thrown a compiler warning, as the GetAccounts() method doesn’t take any inputs.
Hope that fixes your problems.
On a side note, if you are looking to build apps that are not exclusively for Desktop computers (where users can have the Speckle Manager installed), I would suggest to look into our Authentication strategies using Tokens or Speckle Apps you can find more info on how that works here: https://speckle.guide/dev/apps-auth.html
I thought so, considering you’re looking into a netcore app, which can virtually run anywhere
We also have a guide to create a Speckle App, but that’s written in Vue (HTML/JS framework), so the code won’t be exactly the same, but the logic and endpoints used will be.