Skip to content

Amplify Signout while using social signin not Working . #3192

@parekhamit89

Description

@parekhamit89

Before opening, please confirm:

Language and Async Model

Kotlin

Amplify Categories

Authentication

Gradle script dependencies

Details

Environment information

Details
# Put output below this line


Please include any relevant guides or documentation you're referencing

https://docs.amplify.aws/android/build-a-backend/auth/advanced-workflows/

Describe the bug

Workin on Sign in and signout using amplify. Observed local login & logout using email and password work normally but signin using signInWithSocialWebUI method then signOut method doesn't work. While It redirect to browser and redirect back to application successfully, but doesn't get any response from delegate with AuthSignOutResult in coroutin. I am using google as AuthProdvider. Please provide your insight.

Reproduction steps (if applicable)

  1. Sign in with AuthProvider.google using kotlin-coroutin route.
  2. Try to signout using Amplify.signout() using kotlin-coroutin.

Code Snippet

Signing details as follow:
val options = AWSCognitoAuthWebUISignInOptions.builder().prompt(AuthWebUIPrompt.LOGIN, AuthWebUIPrompt.CONSENT).preferPrivateSession(true).build()
                val result = Amplify.Auth.signInWithSocialWebUI(
                    provider = authProvider,
                    callingActivity = callbackActivity,
                    options = options
                )
                Log.i("AuthQuickstart", "Sign in OK: $result")

where as ,sign out use following code with kotlin- coroutin::

AWSCognitoAuthSignOutOptions.builder()
            .globalSignOut(true)
            .build()
        val result: AuthSignOutResult = Amplify.Auth.signOut(options)

tried with below function as well.

fun openHostedUILogout(
        context: Context,
        domain: String,        // e.g. your-domain.auth.us-east-1.amazoncognito.com
        clientId: String,
        redirectUri: String,    // MUST be in Cognito App Client logout URLs
    ) {
        val logoutUrl =
            "https://$domain/logout" +
                    "?client_id=$clientId" +
                    "&response_type=code"+
                    "&logout_uri=$redirectUri"

        val intent = Intent(Intent.ACTION_VIEW, Uri.parse(logoutUrl)).apply {
            flags = Intent.FLAG_ACTIVITY_NEW_TASK
        }

        context.startActivity(intent)
    }
interestingly, it get logout from session but it regenerate session and auto login same user 

Log output

Details
// Put your logs below this line


Configuration File

{
"UserAgent": "aws-amplify-cli/2.0",
"Version": "1.0",
"auth": {
"plugins": {
"awsCognitoAuthPlugin": {
"UserAgent": "aws-amplify-cli/2.0",
"Version": "1.0",
"IdentityManager": {
"Default": {}
},
"CredentialsProvider": {
"CognitoIdentity": {
"Default": {
"PoolId": "eu-st-:41d5",
"Region": "eu-st-"
}
}
},
"CognitoUserPool": {
"Default": {
"PoolId": "eu-west-
_
",
"AppClientId": "5m
********",
"Region": "eu-**st-"
}
},
"Auth": {
"Default": {
"OAuth": {
"WebDomain": "p
c.com",
"AppClientId": "5m
****",
"SignInRedirectURI": "app://callback/",
"SignOutRedirectURI": "app://logout/",
"Scopes": [
"openid",
"email",
"aws.cognito.signin.user.admin"
]
},
"authenticationFlowType": "USER_SRP_AUTH"
}
}
}
}
}
}

GraphQL Schema

Details
// Put your schema below this line

Additional information and screenshots

There is no

Metadata

Metadata

Assignees

No one assigned

    Labels

    authRelated to the Auth category/pluginsbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions