Is there a Realtime event or callback that I can listen to, to monitor the user's authentication status? I'm using React as a front end.
By Auth status, email/phone verification? If so, listen to account
channel, make sure the user is logged in at this point.
@darShan Account channel ? I will check
All possible channels here: https://appwrite.io/docs/apis/realtime#channels
All possible authntication events here: https://appwrite.io/docs/advanced/platform/events#authentication-events
realtime.subscribe('account') { result -> ... }
As darshan mentioned, you can listen to the account
channel.
If you want to use it just to check whether there is a session or not, you can try using the users.*.sessions.*
event.
Thank you very much! @darShan @darShan
Feel free to message back here if you face any issues
& @safwan :appwritecheers:
Sure thing
@safwan @darShan
My goal is to listen to the event when session is ended. I set in appwrite console the session length to 10 seconds.
To subscribe the events, I used:
this.unsubscribeFromUserStatus = client.subscribe(['account', 'users.*.sessions.*'], response => {
console.log('user status updated:', response);
});
I don't get any console.log after 10 seconds. What am I doing wrong? Thank you
I'm not sure if the event will be recd. for the user since they aren't logged in anymore. Pl. cross check with a function or a webhook to see if the event is fired on session end.
@darShan Ok
Recommended threads
- Got message for auto payment of 15usd fo...
how did this happen? 1. i claimed my 50usd credits via jsm hackathon - https://hackathon.jsmastery.pro/ 2. it asked me which org. to apply the credits on, i se...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...