Error : The security token included in the request is invalid - Windows Phone Using AWS SNS
Error : The security token included in the request is invalid - Windows Phone Using AWS SNS
我正在使用以下代码在 AWS SNS 中将设备 (Windows Phone) 注册为应用程序中的端点
CognitoAWSCredentials cognitoProvider = new CognitoAWSCredentials(UserId,
IdentitypoolID,
UnAuthRoleARN,
AuthRoleARN,
Region);
AmazonSimpleNotificationServiceClient sns = new AmazonSimpleNotificationServiceClient(cognitoProvider.GetCredentials().AccessKey.ToString(),
cognitoProvider.GetCredentials().SecretKey.ToString(), REgion); //provide credentials here
var channelOperation = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
CreatePlatformEndpointRequest epReq = new CreatePlatformEndpointRequest();
epReq.PlatformApplicationArn = ApplicationArn;
epReq.Token = channelOperation.Uri.ToString();
CreatePlatformEndpointResponse epRes = await sns.CreatePlatformEndpointAsync(epReq);
CreateTopicRequest tpReq = new CreateTopicRequest();
SubscribeResponse subsResp = await sns.SubscribeAsync(new SubscribeRequest()
{
TopicArn = TopicArn,
Protocol = "application",
Endpoint = epRes.EndpointArn
});
创建端点时抛出错误请求中包含的安全令牌无效执行以下代码时
CreatePlatformEndpointResponse epRes = await sns.CreatePlatformEndpointAsync(epReq);
请帮我实现这个。提前致谢
使用以下代码在 AWS SNS 应用程序中注册 windows phone 设备。我可以使用以下代码创建端点。
private async void Push()
{
CognitoAWSCredentials cognitoProvider = new CognitoAWSCredentials(UserId,
IdentitypoolID,
UnAuthRoleARN,
AuthRoleARN,
Region);
using (var sns = new AmazonSimpleNotificationServiceClient(credentials, RegionEndpoint.USEast1))
{
var channelOperation = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
CreatePlatformEndpointRequest epReq = new CreatePlatformEndpointRequest();
epReq.PlatformApplicationArn = "PlatformApplicationARN";
epReq.Token = channelOperation.Uri.ToString();
CreatePlatformEndpointResponse epRes = await sns.CreatePlatformEndpointAsync(epReq);
CreateTopicRequest tpReq = new CreateTopicRequest();
SubscribeResponse subsResp = await sns.SubscribeAsync(new SubscribeRequest()
{
TopicArn = "TopicARN",
Protocol = "application",
Endpoint = epRes.EndpointArn
});
channelOperation.PushNotificationReceived += ChannelOperation_PushNotificationReceived;
}
}
我正在使用以下代码在 AWS SNS 中将设备 (Windows Phone) 注册为应用程序中的端点
CognitoAWSCredentials cognitoProvider = new CognitoAWSCredentials(UserId,
IdentitypoolID,
UnAuthRoleARN,
AuthRoleARN,
Region);
AmazonSimpleNotificationServiceClient sns = new AmazonSimpleNotificationServiceClient(cognitoProvider.GetCredentials().AccessKey.ToString(),
cognitoProvider.GetCredentials().SecretKey.ToString(), REgion); //provide credentials here
var channelOperation = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
CreatePlatformEndpointRequest epReq = new CreatePlatformEndpointRequest();
epReq.PlatformApplicationArn = ApplicationArn;
epReq.Token = channelOperation.Uri.ToString();
CreatePlatformEndpointResponse epRes = await sns.CreatePlatformEndpointAsync(epReq);
CreateTopicRequest tpReq = new CreateTopicRequest();
SubscribeResponse subsResp = await sns.SubscribeAsync(new SubscribeRequest()
{
TopicArn = TopicArn,
Protocol = "application",
Endpoint = epRes.EndpointArn
});
创建端点时抛出错误请求中包含的安全令牌无效执行以下代码时
CreatePlatformEndpointResponse epRes = await sns.CreatePlatformEndpointAsync(epReq);
请帮我实现这个。提前致谢
使用以下代码在 AWS SNS 应用程序中注册 windows phone 设备。我可以使用以下代码创建端点。
private async void Push()
{
CognitoAWSCredentials cognitoProvider = new CognitoAWSCredentials(UserId,
IdentitypoolID,
UnAuthRoleARN,
AuthRoleARN,
Region);
using (var sns = new AmazonSimpleNotificationServiceClient(credentials, RegionEndpoint.USEast1))
{
var channelOperation = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
CreatePlatformEndpointRequest epReq = new CreatePlatformEndpointRequest();
epReq.PlatformApplicationArn = "PlatformApplicationARN";
epReq.Token = channelOperation.Uri.ToString();
CreatePlatformEndpointResponse epRes = await sns.CreatePlatformEndpointAsync(epReq);
CreateTopicRequest tpReq = new CreateTopicRequest();
SubscribeResponse subsResp = await sns.SubscribeAsync(new SubscribeRequest()
{
TopicArn = "TopicARN",
Protocol = "application",
Endpoint = epRes.EndpointArn
});
channelOperation.PushNotificationReceived += ChannelOperation_PushNotificationReceived;
}
}