簡體   English   中英

Amazon SimpleNotificationService請求的令牌丟失

[英]Missing Token for Amazon SimpleNotificationService Request Amazon AWS SDK

我正在嘗試使用.NET SDK(2.3.35.0)並創建一個終結點(APNS訂閱)。 我已經有一個在AWS中定義的應用程序,並且具有一個應用程序信息。 我已經存儲了一個APNS令牌(端點),並且通過控制台,我已經能夠向該設備發送推送通知。

我遇到的麻煩是將createPlatformEndpoint發送到Amazon的SNS系統。 我收到此錯誤:

"Message": "An error has occurred.",
  "ExceptionMessage": "Request is missing Authentication Token",
  "ExceptionType": "Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceException"

這是我發送請求的方法:

public void addAPNSSubscription(string platformAppARN, string deviceToken)
{
  using (var client = new AmazonSimpleNotificationServiceClient(_snsAccessKey, _snsSecretAccessKey, _snsClientConfig))
  {
    var endpointRequest = new CreatePlatformEndpointRequest { PlatformApplicationArn = platformAppARN, Token = deviceToken };
    endpointRequest.CustomUserData = "Testing from .NET";

   var result = client.CreatePlatformEndpoint(endpointRequest);
  }
}

我確定缺少的身份驗證令牌是OAuth令牌,我只是不知道如何通過.NET SDK獲得它。 先謝謝您的幫助。

我很蠢。 我正在使用一個現有的類,並假定已正確讀取config屬性。 他們不是。 當我解決該問題后,請求就順利了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM