0

I am using federated sign in using AWS Amplify SDK. Following is my awsconfigfile.json

{ "UserAgent": "aws-amplify-cli/0.1.0", "Version": "0.1.0", "IdentityManager": { "Default": {} }, "CredentialsProvider": { "CognitoIdentity": { "Default": { "PoolId": "us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "Region": "us-east-1" } } }, "CognitoUserPool": { "Default": { "PoolId": "us-east-1_xxxxxxxxx", "AppClientId": "xxxxxxxxxxxxxxxxxxxxxxxxxx", "AppClientSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "Region": "us-east-1" } }, "Auth": { "Default": { "authenticationFlowType": "CUSTOM_AUTH" } } }

    let awsClient = AWSMobileClient.default()
    
    awsClient.federatedSignIn(providerName: Configuration.current.awsSAMLProvider,
                                              token: token) { (userState, error) in

        if let userState = userState {
            print("Status: \(userState.rawValue)")
            awsClient.getAWSCredentials { creds, error in
                if let creds = creds {
                    onComplete(.success)
                } else if let error = error {
                    
                }
            }
        }
    }

I tried many things but always getting following error "There is no valid cognito identity pool configured in awsconfiguration.json."

Nilesh Tupe
  • 43
  • 1
  • 6

1 Answers1

0

Adding initialization code in App Delegate fixed this issue

    AWSMobileClient.default().initialize { (userState, error) in
        
    }

https://github.com/aws-amplify/aws-sdk-ios/issues/1773

Nilesh Tupe
  • 43
  • 1
  • 6