account.get() does not check if Appwrite account is still linked with Google auth.
- 0
- Self Hosted
- Web
unlink google account
button goes to the unlink google account page
and yk the user can unlink
this page
isn't that a bit problematic because on my side, the only form of auth is google π€
For good user experience, you can delete the session afterwards automatically, and they wont be able to sign-in again. Keep in mind this leaves a "zombie" account which cannot be accessed, but isn't deleted; you still store their data.
My recommendation here would be ability to delete, or block the account instead.
In my opinion, unlink makes more sense where there are multiple providers, and you want to unlink a specific one (often to link to same provider but with another account)
by delete the session afterwards automatically, how would i be able to do that?
like a) on button press, session is deleted b) or when detect unlinked, session is deleted
?
also the zombie account is fine
OAuth providers usually allow a redirectURL - they redirect user there after changing configurations to OAuth permissions.
So that would be B).
But honestly, A) doesnt sound too bad - if they decide not to delete and come back, they can simply sign-in again. And it's simpler to implement than B)
say we go for B,
how would that work?
because the only solution that I could find was to use user = account.get() and see what's inside user.prefs
but theres nothing in there
oh the other way was to get the oauth google token and check that with google's own API but idk how to get the token
You can do account.getSession('current'), and it sohuld have both refresh token, and access tokens (tokens used to do calls to Google APIs on behalf of the user)
oh whaaatt ok
so im assuming its just like
try {
account.getSession('current');
} catch (e) {
console.log("Unable to log in user", e);
handleLogout(); // or whatever
}
or would account.getSession('current') return something
That would check for Appwrite user, same as account.get(). You need something like (pseudo code)
session = accoutn.getSession(current)
token = session.accessToken
response = fetch(api.google.com/v1/users, {
headers: { authroization: token }
})
if(response.ok is false) {
handleLogout();
}
ok lemme take a look
Recommended threads
- TablesDB `updateRows` returns `database_...
Hi Appwrite team! Iβm seeing a strange issue with TablesDB bulk row updates on a self-hosted Appwrite instance. **Environment** - Appwrite self-hosted `1.9.0` ...
- [SOLVED] Realtime Missing Channels
```js useEffect(() => { let subscription: RealtimeSubscription; async function loadChips() { try { const {rows: chi...
- Functions executed by events does not ap...
Hello, Running self-hosted Appwrite version 1.9.0 (with console 7.8.26). When functions are triggered by an event (eg. databases.\*tables.\*.rows.\*.create) doe...