appwrite / appwrite/appwrite

🐛 Bug Report: OAuth Login Fails if Browser Session Already Exists for Another User

Open
#7,021 4 comments 0 reactions 0 assignees View on GitHub
bug product / auth
Dominant language
TypeScript
Stars
57.4k
Forks
5.7k
Avg merge
14h 50m
Merged PRs (30d)
276

Description

### 👟 Reproduction steps

1) Create an App with OAuth Logic.
2) Create two users, User A and User B, with different identities.
3) Log in with User A and delete the app, which leaves the browser session active.
4) Attempt to log in with User B. This will fail due to the active User A browser session.
5) You won't be able to log in with any user other than User A until the active session for User A is cleared.

### 👍 Expected behavior

There is nothing wrong with actual behavior, but I believe additional steps are necessary; otherwise, it may become challenging for the user to log back in. There are two potential solutions:

1) Upon reinstallation, programmatically enable the creation of a new in-app session for an existing browser session, if possible.

2) Provide a method for detecting the currently active browser session because there is no other way for the user to log in with an identity linked to a different user. Please note that `account.deleteSession(sessionId: 'current')` and `account.deleteSessions()` result in an error.

### 👎 Actual Behavior

Error `user_already_exists` with code 409.

### 🎲 Appwrite version

Version 1.4.x

### 💻 Operating system

Linux

### 🧱 Your Environment

Appwrite Instance - 1.4.3
Appwrite Flutter SDK - 11.0.0

### 👀 Have you spent some time to check if this issue has been raised before?

- [X] I checked and didn't find similar issue

### 🏢 Have you read the Code of Conduct?

- [X] I have read the [Code of Conduct](https://github.com/appwrite/.github/blob/main/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.