Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

  • https://docs.amplify.aws/lib/auth/social_signin_web_ui/q/platform/ios/
  • https://docs.amplify.aws/lib/auth/existing-resources/q/platform/ios/

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.

  • https://i.sstatic.net/tmbWB.png
  • https://i.sstatic.net/FnxbN.png
like image 515
joybro Avatar asked Nov 17 '25 09:11

joybro


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"
}
like image 90
joybro Avatar answered Nov 18 '25 22:11

joybro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!