Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HostedUI SignIn failure #1066

Closed
YarinShitrit opened this issue Dec 17, 2020 · 1 comment
Closed

HostedUI SignIn failure #1066

YarinShitrit opened this issue Dec 17, 2020 · 1 comment
Labels
auth Related to the Auth category/plugins closing soon This issue will be closed in 7 days unless further comments are made. question General question

Comments

@YarinShitrit
Copy link

I am following the docs for implementing the Auth and Cognito into my android application and I am facing an error when trying to signin through facebook with hostedUI.
Here is the logcat error :

AuthException{message=Sign in with web UI failed, cause=java.lang.Exception: showSignIn called with HostedUI options in awsconfiguration.json, recoverySuggestion=See attached exception for more details}

my LoginFragment code :

facebook_login_btn.setOnClickListener {
            Log.d(TAG, "Facebook Login Clicked")
            Amplify.Auth.signInWithSocialWebUI(
                facebook(),
                requireActivity(),
                { result -> Log.i("AuthQuickstart", result.toString()) },
                { error -> Log.e("AuthQuickstart", error.toString()) }
            )

amplifyconfiguration.json :

{
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify-cli/0.1.0",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "CredentialsProvider": {
                    "CognitoIdentity": {
                        "Default": {
                            "PoolId": "us-east-1:4db6e400-f476-4b89-8b29-30b23add725c",
                            "Region": "us-east-1"
                        }
                    }
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "us-east-1_Kx8oX5aOV",
                        "AppClientId": "7nncao1a0fpj4p2m96k8lfchtd",
                        "AppClientSecret":
                        "vi3u71t4iohmqqddu1o8hgrssnhbojlcd9mj18od3ogjv8catov",
                        "Region": "us-east-1"
                    }
                },
                "Auth": {
                    "Default": {
                        "authenticationFlowType": "USER_SRP_AUTH"
                    }
                }
            }
        }
    }
}

awsconfiguration.json:

{
    "UserAgent": "aws-amplify-cli/0.1.0",
    "Version": "0.1.0",
    "IdentityManager": {
        "Default": {}
    },
    "CredentialsProvider": {
        "CognitoIdentity": {
            "Default": {
                "PoolId": "us-east-1:4db6e400-f476-4b89-8b29-30b23add725c",
                "Region": "us-east-1"
            }
        }
    },
    "CognitoUserPool": {
        "Default": {
            "PoolId": "us-east-1_Kx8oX5aOV",
            "AppClientId": "7nncao1a0fpj4p2m96k8lfchtd",
            "AppClientSecret":
            "vi3u71t4iohmqqddu1o8hgrssnhbojlcd9mj18od3ogjv8catov",
            "Region": "us-east-1"
        }
    },
    "Auth": {
        "Default": {
            "authenticationFlowType": "USER_SRP_AUTH"
        }
    }
}

Any suggestions ?
Thanks

@richardmcclellan richardmcclellan transferred this issue from aws-amplify/aws-sdk-android Dec 21, 2020
@richardmcclellan richardmcclellan added auth Related to the Auth category/plugins question General question labels Dec 21, 2020
@richardmcclellan
Copy link
Contributor

richardmcclellan commented Dec 21, 2020

Hi @YarinShitrit based on your configuration files, it looks like you haven't configured an OAuth flow, which is required for HostedUI. When you run amplify add auth, choose Default configuration with Social Provider (Federation).

Your amplifyconfiguration.json should have an OAuth object. It should look something like this:

{
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "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_xxxxxxxxxx",
                        "AppClientId": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
                        "AppClientSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                        "Region": "us-east-1"
                    }
                },
                "Auth": {
                    "Default": {
                        "OAuth": {
                            "WebDomain": "myappxxxxxxx-xxxxxxxx-dev.auth.us-east-1.amazoncognito.com",
                            "AppClientId": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
                            "AppClientSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                            "SignInRedirectURI": "myapp://callback/",
                            "SignOutRedirectURI": "myapp://signout/",
                            "Scopes": [
                                "phone",
                                "email",
                                "openid",
                                "profile",
                                "aws.cognito.signin.user.admin"
                            ]
                        },
                        "authenticationFlowType": "USER_SRP_AUTH"
                    }
                }
            }
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Related to the Auth category/plugins closing soon This issue will be closed in 7 days unless further comments are made. question General question
Projects
None yet
Development

No branches or pull requests

2 participants