使用Manatee.Trello时无效的令牌

时间:2017-10-10 02:19:01

标签: manatee.trello

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

以下是基于维基页面Manatee.Trello Usage中的示例演示此问题的简短示例。它正试图访问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'

提前感谢您的关注。

BruceP

1 个答案:

答案 0 :(得分:2)

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

解决问题

  1. https://trello.com/app-key
  2. 获取新的开发人员API密钥
  3. https://trello.com/1/authorize?expiration=never&scope=read,write,account&response_type=token&name=Server%20Token&key=
  4. 获取新的用户令牌