我對亞馬遜Cognito我們開發者認證的身份集我的iOS應用Amazon Web服務:錯誤 - 請求中包含的安全令牌是無效的
我按照文檔中的教程: Using Developer Authenticated Identities
我的後端能夠生成標記並獲得身份標識而沒有問題。 我可以按照指示在iOS應用程序中初始化cognito。 但我須在dynamoDb請求,我得到的錯誤
The security token included in the request is invalid
Cognito初始化代碼:
MyIdentityProvider *identityProvider = [MyIdentityProvider new];
[identityProvider setIdentityPoolId:COGNITO_POOL_ID];
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc]
initWithRegionType:AWSRegionUSEast1
identityProvider:identityProvider
unauthRoleArn:nil
authRoleArn:COGNITO_ROLE_AUTH];
AWSServiceConfiguration *configuration = [AWSServiceConfiguration configurationWithRegion:AWSRegionUSEast1
credentialsProvider:credentialsProvider];
[AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
[[credentialsProvider getIdentityId] continueWithSuccessBlock:^id(BFTask *task){
//In here I can see that everything is ok.
//I have a token and cognitoId
//But despite this, when I make requests I get "The security token included in the request is invalid"
return nil;
}];
有誰知道我可能是做錯了什麼?
您應該通過調用'[AWSLogger defaultLogger] .logLevel = AWSLogLevelVerbose;'來啓用詳細日誌記錄。這可能是調試問題的一個很好的第一步。 –