缺少 Amazon SimpleNotificationService 请求的令牌 Amazon AWS SDK

Missing Token for Amazon SimpleNotificationService Request Amazon AWS SDK

我正在尝试使用 .NET SDK (2.3.35.0) 并创建端点(APNS 订阅)。我已经在 AWS 中定义了一个应用程序并且有一个应用程序 arn。我已经存储了一个 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 获取它。在此先感谢您的帮助。

我很笨。我正在使用现有的 class,并假设配置属性被正确读取。他们不是。当我解决了这个问题后,请求就没有问题了。