aws-amplify / aws-amplify/amplify-android

Amplify Signout while using social signin not Working .

Open
#3,192 2 comments 0 reactions 0 assignees View on GitHub
auth bug
Dominant language
Java
Stars
287
Forks
132
Avg merge
2d 2h
Merged PRs (30d)
45

Description

### Before opening, please confirm:

- [x] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-android/issues?q=is%3Aissue+) and [discussions](https://github.com/aws-amplify/amplify-android/discussions).

### Language and Async Model

Kotlin

### Amplify Categories

Authentication

### Gradle script dependencies

### Environment information

```
# 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

```kotlin
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

```
// 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-*:41**********d5",
"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

```graphql
// Put your schema below this line

```

### Additional information and screenshots

There is no

Contributor guide

Open the contributing guide

Research direction

Start with the linked Amplify Android advanced authentication workflows guide and trace the reported Kotlin flow from signInWithSocialWebUI to Amplify.Auth.signOut. Check how the coroutine-based call reports its AuthSignOutResult and how the browser redirect returns to the app. Done means social sign-in can be followed by sign-out without the user being automatically signed back in.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, aws, kotlin
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.