DocumentDB + Xamarin - 授权令牌无效

DocumentDB + Xamarin - The authorization token is not valid

我正在尝试解决我使用 Xamarin Forms + DocumentDB 制作的应用程序中的一个严重错误。我正在使用包 Microsoft.Azure.DocumentDB.Core 来存储数据。 我们的 Azure 帐户托管在巴西南部 (GMT-3),应用程序运行正常。但我们注意到,在语言环境时间为 GMT-4 的地区,应用程序崩溃并出现上述异常。

The authorization token is not valid at the current time. Please 
create another token and retry (token start time: Mon, 27 Mar 2017
00:07:41 GMT, token expiry time: Mon, 27 Mar 2017 00:22:41 GMT, 
current server time: Mon, 27 Mar 2017 01:08:24 GMT).
ActivityId: 81487924-68ee-4329-bb61-02f88ea7b6ec

如果我延迟我的设备一小时来获取 GMT-4,并且 运行 我可以看到异常的应用程序。

    //---------------------------------------------static Repository initialize
    DocumentClient client;
    const string collectionId = "user";
    Uri uri = UriFactory.CreateDocumentCollectionUri(Constants.DB_ID, collectionId);

    //---------------------------------------------static constructor
    UserDataService()
    {
        client = new DocumentClient(
                new Uri(Constants.DB_ACCOUNT_URL),
                        Constants.DB_ACCOUNT_KEY);
    }

    async public Task<User> GetUserByCPF(string cpf)
    {
        var fedOpt = new FeedOptions { MaxItemCount = -1 };
        var query = client.CreateDocumentQuery<User>(uri, fedOpt)
                          .Where(x => x.Id == _id)
                          .AsDocumentQuery();

        var lst = new List<User>();
        while (query.HasMoreResults)
        {
            lst.AddRange(await query.ExecuteNextAsync<User>());
        }

        return lst.FirstOrDefault();
    }

例外情况在 query.ExecuteNextAsync;

错误消息说要创建另一个令牌,但我使用的是主密钥。有人知道如何为 Master Key 创建令牌或增加到期日期吗?

根据我的经验,字符串的日期部分是 UTC 日期 由 SDK 生成令牌。而且我无法在我的 side.The 上用不同的区域重现这个问题,唯一的例外是本地设备系统不正确。

所以我假设异常是由设备使用不正确的时间引起的。