2

我开始使用 C# Trello API。我创建了简单的控制台应用程序,并首先运行它以获取访问令牌:

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打开我的默认浏览器实例,我允许访问该应用程序,并在下一页上获得了我的令牌。然后我硬编码令牌并尝试实现这个例子

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);
}

me始终为空。我错过了什么?授权失败?如果是这样,我为什么不得到TrelloNet.TrelloUnauthorizedException

编辑: 过了一会儿,我在这个线程Json.NET中发现了一些关于项目中包含的版本的建议,所以我更新了,现在我没有收到任何消息:Json.NETTrelloNet.TrelloException

Member me = trello.Members.Me();

没有任何消息的 TrelloNet.TrelloException

堆栈跟踪:

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()
4

0 回答 0