Amplify.Auth.signInWithWebUI is launching webview with empty HTTP URL

Viewed 396

Problem

Amplify's signInWithWebUI is opening an webview for sign-in, but it opens with empty URL like you can see in the attached images at the bottom. I'm struggling to point out what configuration determines this signin URL. Any hint or help would be very appreciated. Thanks.

More context

I'm trying to implement Social signin with Google in my ios app. I already have AWS Cognito setup for Google signin that is working fine in my web app, so I've added amplify-ios package to my ios, configured and called signInWithWebUI function following these guides.

Here is how I'm calling the function and Amplify configuration file(amplifyconfiguration.json).

Amplify.Auth.signInWithWebUI(for: AuthProvider.google,
    presentationAnchor: UIApplication.shared.windows.filter {$0.isKeyWindow}.first!
)
{
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "IdentityManager": {
                    "Default": {}
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "us-east-1_[REDACTED]",
                        "AppClientId": "[REDACTED]",
                        "Region": "us-east-1"
                    }
                },
                "Auth": {
                    "Default": {
                        "authenticationFlowType": "USER_SRP_AUTH",
                        "OAuth": {
                            "WebDomain": "https://[REDACTED].auth.us-east-1.amazoncognito.com",
                            "AppClientId": "[REDACTED]",
                            "SignInRedirectURI": "myapp://callback/",
                            "SignOutRedirectURI": "myapp://signout/",
                            "Scopes": [
                                "email",
                                "openid",
                                "profile",
                                "aws.cognito.signin.user.admin"
                            ]
                        },
                    }
                }
            }
        }
    }
}

These are what the app shows when signInWithWebUI is called.

1 Answers

It turned out that WebDomain in the configuration file shouldn't include "https://" part. Now it looks like following and it loads Google's signin page properly.

{
    "WebDomain": "[REDACTED].auth.us-east-1.amazoncognito.com"
}
Related