I'm getting started with C# Trello API. I'we created simple console application, and ran it first to get access token:
static void GetToken()
{
ITrello trello = new Trello("application key");
var url = trello.GetAuthorizationUrl("Test api", Scope.ReadWrite, Expiration.Never);
Process.Start(url.ToString());
}
Process.Start
opened my default browser instance, I allowed access for the application and on the next page got my token. Then I hardcoded the token and tried to implement this example:
static void Main(string[] args)
{
ITrello trello = new Trello("application key");
trello.Authorize(token); // hardcoded token
Member me = trello.Members.Me();
Console.WriteLine(me.FullName);
}
But me
is always null. What am I missing? Is authorization failed? If so, why don't I get TrelloNet.TrelloUnauthorizedException
?
EDITS:
After a while I'we found some suggestion about Json.NET
version included in the project in this thread so I updated Json.NET
and now I get TrelloNet.TrelloException
with no message in line:
Member me = trello.Members.Me();
StackTrace:
at TrelloNet.Internal.TrelloRestClient.ThrowIfRequestWasUnsuccessful(IRestRequest request, IRestResponse response)
at TrelloNet.Internal.TrelloRestClient.Request[T](IRestRequest request)
at TrelloNet.Internal.Members.Me()
at ConsoleApplication1.Program.Main(String[] args) in f:\Dropbox\Projects\TrelloManager\ConsoleApplication1\Program.cs:line 26
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
This might help. I had the same problem of everything coming back
null
. I found that getting latest versions of certain components solved the problem.See this article: Trello.Net authorisation works but cannot access data once authorised