In my flutter app I have 2 oauth sign in buttons (apple and discord).. I noticed that if I sign in first with discord oauth2 then all is fine and a new verified account is created in appwrite. But if I uninstall the app and reinstall it and then if I try to sign in with another oauth2 provider like apple then it does redirect me to apple oauth2 session but once its completed I am logged in from my discord account...
Summary
The user is experiencing an issue where signing in with a new OAuth2 session after uninstalling and reinstalling the app logs them in with their old Discord account instead of the new Apple account. They ask if changing the behavior based on the type of session initiated by the user would improve the situation. The user also suggests deleting the old session or clearing browser data to resolve the issue. The solution mentioned is to delete the Discord session from the Appwrite auth console and then restart the app, which allows the creation of a new session with the Apple account. The user also mentions that after reinstalling the app, it is unable to detect anything from
Infinil
Rank 6: Server
Aug 31, 2023, 06:38
i dont think created sessions for discord could be a problem? since apple account is different than my discord account
Infinil
Rank 6: Server
Aug 31, 2023, 06:39
btw after re-installing the app (newly opened).. its unable to detect anything from account.get() hence redirected to login screen.. so idk why later it just logs me in with my earlier account (i.e discord)
Infinil
Rank 6: Server
Aug 31, 2023, 06:42
_
_
point to note - if i delete the discord session from appwrite auth console and restart the app then apple oauth2 session does create a new session with apple account
Drake
Admin
Aug 31, 2023, 18:53
are the emails the same in discord and apple?
Infinil
Rank 6: Server
Aug 31, 2023, 18:54
nope
Drake
Admin
Aug 31, 2023, 18:55
actually...nvm this is sort of expected. the browser still has the appwrite session. that's why a new account isn't created
Infinil
Rank 6: Server
Aug 31, 2023, 18:57
oh welp maybe smth we can do so user knows what to do.. would instructing them to clear browser cache/ cookies work?
Drake
Admin
Aug 31, 2023, 18:58
maybe delete the old session or clear browser data (cookies). clearing cache won't help
Infinil
Rank 6: Server
Aug 31, 2023, 18:58
but how will i know as a developer which session to delete since await account.get() doesnt detect an account on re installing
Infinil
Rank 6: Server
Aug 31, 2023, 19:00
one more question whats wrong in changing this behavior like if user is trying to create a new account then appwrite by itself deleting any old existing session and creating new session with new account?
Drake
Admin
Aug 31, 2023, 19:06
you might have to do something server-side 🤷🏼♂️
Drake
Admin
Aug 31, 2023, 19:07
it's behaving as intended for cases like use has an anonymous session and then they create an oauth2 session to convert their anonymous account to one with email
Infinil
Rank 6: Server
Aug 31, 2023, 19:15
i see i understand i have no knowledge of how things work behind the scenes but changing the behaviour depending on what sort of session has been initiated by user might improve the situation?
Infinil
Rank 6: Server
Aug 31, 2023, 19:15
but either way thanks for the help
Infinil
Rank 6: Server
Aug 31, 2023, 19:15
appreciate it 👍
Drake
Admin
Aug 31, 2023, 19:18
[CLOSED] Auth signs in with old session account after OAuth2 Session