3

我一直在使用 Manatee.Trello 扫描我们 Trello 板上的卡片以进行报告。然而,今天早上,已经工作了数周的扫描代码停止了工作。它似乎给出了一个 HttpRequestException: 'invalid token'。

这是一个演示问题的简短示例,基于 wiki 页面 Manatee.Trello 使用中的示例。它正在尝试访问 Trello.com 欢迎板。

using System;
using System.Diagnostics;
using Manatee.Trello;
using Manatee.Trello.ManateeJson;
using Manatee.Trello.WebApi;
using Manatee.Trello.Exceptions;

namespace MspUpdate
{
    class Program
    {

        static void Main(string[] args)
        {
            string BrdNm;
            Exception innerException = null;
            TrelloInteractionException te = new TrelloInteractionException(innerException);

            var serializer = new ManateeSerializer();
            TrelloConfiguration.Serializer = serializer;
            TrelloConfiguration.Deserializer = serializer;
            TrelloConfiguration.JsonFactory = new ManateeFactory();
            TrelloConfiguration.RestClientProvider = new WebApiClientProvider();
            TrelloAuthorization.Default.AppKey = "MyAppKey";
            TrelloAuthorization.Default.UserToken = "MyUserToken";

            var board = new Board("7yuDFMwI");
            Debug.WriteLine(board);
        }
    }
}

以下是异常的详细信息:

System.AggregateException occurred
HResult=0x80131500
Message=One or more errors occurred.
Source=Manatee.Trello
StackTrace:
at Manatee.Trello.Internal.ExceptionHandling.DebugLog.Error(Exception e, Boolean shouldThrow)
at Manatee.Trello.Internal.DataAccess.JsonRepository.ValidateResponse(IRestRequest request)
at Manatee.Trello.Internal.DataAccess.JsonRepository.Execute[T](TrelloAuthorization auth, Endpoint endpoint, IDictionary`2 parameters)
at Manatee.Trello.Internal.Synchronization.BoardContext.GetData()
at Manatee.Trello.Internal.Synchronization.SynchronizationContext`1.Merge()
at Manatee.Trello.Internal.Synchronization.SynchronizationContext.Synchronize(Boolean force)
at Manatee.Trello.Board.ToString()
at System.Diagnostics.TraceListener.WriteLine(Object o)
at System.Diagnostics.TraceInternal.WriteLine(Object value)
at System.Diagnostics.Debug.WriteLine(Object value)
at MspUpdate.Program.Main(String[] args) in C:\Users\Bruce Pike Rice\Documents\Source\a2\JiraInteraction\Program.cs:line 33

Inner Exception 1:
HttpRequestException: Trello reported an error: 'invalid token'

提前感谢您的关注。

布鲁斯P

4

1 回答 1

3

该问题是由过期的用户令牌引起的。感谢 Greg Dennis 指出这一点。

解决问题

  1. 从https://trello.com/app-key获取新的开发者 API 密钥
  2. 从https://trello.com/1/authorize?expiration=never&scope=read,write,account&response_type=token&name=Server%20Token&key=获取新的用户令牌
于 2017-10-10T21:15:10.410 回答