AWS Cognito API를 사용하여 Swift로 작성된 iOS 앱이 있습니다. USEast1에 연결하면 예상대로 작동하고 특정 아무것도 지역으로, 내 사용자AWS Cognito 전용 USEast1에서 작업 중
var awsProperties = NSDictionary(contentsOfFile: NSBundle.mainBundle().pathForResource("AWS", ofType: "plist")!)
var credentialsProvider : AWSCognitoCredentialsProvider
var loggedIn = false
override init() {
credentialsProvider = AWSCognitoCredentialsProvider.credentialsWithRegionType(
AWSRegionType.USEast1,
accountId:awsProperties?.valueForKey(GlobalConstants.AccountId) as String,
identityPoolId:awsProperties?.valueForKey(GlobalConstants.USIdentityPoolId) as String,
unauthRoleArn:awsProperties?.valueForKey(GlobalConstants.UnauthDefaultRole) as String,
authRoleArn:awsProperties?.valueForKey(GlobalConstants.AuthDefaultRole) as String)
}
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
let defaultServiceConfiguration = AWSServiceConfiguration(
region: AWSRegionType.USEast1,
credentialsProvider: credentialsProvider)
AWSServiceManager.defaultServiceManager().setDefaultServiceConfiguration(defaultServiceConfiguration)
credentialsProvider.getIdentityId().continueWithBlock { (task: BFTask!) -> AnyObject! in
if((task.error) != nil) {
NSLog("%@", task.error)
} else {
NSLog("%@", self.credentialsProvider.identityId)
self.loggedIn = true
}
return self.loggedIn
}
return true
}
내가 별도의 로그인 컨트롤러에서 G +에 대한 로그인을 허용하는 데 필요한 코드를 인증합니다.
나는 똑같은 코드,하지만를 사용하지만 경우 EUWest1에이 지역을 변경하고 내 유럽 연합 (EU) 나는 다음과 같은 예외가 얻을 풀을 식별 기반의 사용 :
이AWSiOSSDKv2 [Error] AWSCredentialsProvider.m line:453 | __46-[AWSCognitoCredentialsProvider getIdentityId]_block_invoke | In refresh, but identityId is nil.
AWSiOSSDKv2 [Error] AWSCredentialsProvider.m line:454 | __46-[AWSCognitoCredentialsProvider getIdentityId]_block_invoke | Result from getIdentityId is (null)
내 IAM 역할에 대한 신뢰 정책 모두에 액세스 할 수 있습니다를 ID 풀 :
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Federated": "accounts.google.com"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"cognito-identity.amazonaws.com:aud": [
"eu-west-1:XXXXXX",
"us-east-1:XXXXXX"
]
},
"ForAnyValue:StringLike": {
"cognito-identity.amazonaws.com:amr": "authenticated"
}
}
}
]
}
내가이 영역을 재정의해야합니까?