I am new to Trello.Net
and struggling a little with authorisation. I understand the process, of requesting a URL and then asking the user to browse to that URL to get a token.
The first problem is I am trying to write a process which runs automatically without any UI. So I'm having to use a hard coded token, which I obtained by running this code to get a URL, which I then browse to manually. I would rather do this part automatically (get the resulting token programatically, not by having the user browse somewhere):
ITrello trello = new Trello(Key);
var url = trello.GetAuthorizationUrl("TrelloCapture", Scope.ReadWrite, Expiration.Never);
Console.WriteLine(url);
This URL, when I browse to it, displays for me a token which, for now, I hardcoded into my application as follows:
var token = "[the token copied and pasted from the web page]"
I then authorise using:
trello.Authorize(token);
Which seems to work fine. Next I want to access some basic data, and this is where my second problem comes in.
// Get the authenticated member
Member me = trello.Members.Me();
Console.WriteLine(me.FullName);
Members.Me()
returns null
every time. The same problem with Cards.ForMe()
and other methods. Everything is null
. Why?
What am I doing wrong?
I found the answer. I fixed it by getting the latest versions of these
NuGet
packages in my solution:Trello.Net
JSON.Net
RestSharp
After getting those latest versions I was seeing proper values instead of
null
in the trello objects.Hope this helps somebody who reads this.
Had the same problem, above answer helped me. Though I couldn't get the latest but had to use:
"RestSharp" version="104.1 "Newtonsoft.Json" version="6.0.1"
Since The nuget also doesn't have the correct color enum i had to download the project and make my own changes.