我一直在使用Manatee。Trello扫描我们Trello板上的卡片以进行报告。然而,今天早上,已经工作了几个星期的扫描码停止了工作。它似乎给出了HttpRequestException:"无效令牌"。
下面是一个简短的例子,根据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:UsersBruce Pike RiceDocumentsSourcea2JiraInteractionProgram.cs:line 33
Inner Exception 1:
HttpRequestException: Trello reported an error: 'invalid token'
提前感谢您的关注。
BruceP
问题是由过期的用户令牌引起的。感谢Greg Dennis指出这一点。
修复问题
- 从获取新的开发人员API密钥https://trello.com/app-key
- 从获取新用户令牌https://trello.com/1/authorize?expiration=never&scope=读取、写入、帐户&response_type=令牌&name=服务器%20Token&钥匙=