Back

how to restrict user to login in only one or two device.

  • 0
  • Users
  • Accounts
  • Flutter
new user
3 May, 2023, 21:32

using appwrite how we can restrict user to login or use there account with only two or one devices.

TL;DR
To restrict users to login from only one or two devices using Appwrite, you can create a function that triggers on session creation. This function can perform the necessary logic to enforce the device restrictions. You will need to refer to the Appwrite documentation on Functions and Users API for details. Unfortunately, there is no out-of-the-box solution for this functionality in Appwrite. You will need to implement it using an Appwrite Function. If you want to restrict different users to different sessions, you can set the maximum number of sessions in the project's auth security settings. This will allow you to control the number of devices a user can use to
Drake
3 May, 2023, 21:40

In your project auth security settings, you can set a max number of sessions:

new user
3 May, 2023, 21:43

thanks, this will work from server side what if want to provide different user to different different sessions.

Drake
3 May, 2023, 21:45

what? sorry, I don't understand what you're asking

new user
3 May, 2023, 21:49

no problem, suppose i have two account with user1 and user2 then user1 can login with only 2 devices and user2 can login with only one(1) devices.

Drake
3 May, 2023, 21:51

there's nothing out of the box for that. you'll need to do something using an Appwrite Function for this

new user
3 May, 2023, 21:52

using function how can i achieve this,

Drake
3 May, 2023, 21:54

trigger a function on session creation, do some logic, delete the session. See the docs:

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more