Need suggestions for implementing and testing Temporary users

Hello everyone!:wave: I am a beginner, making a side project using PETAL framework for learning.
I am trying to make a real-time chat application where users can use some limited features without logging in to their accounts. I am planning to maintain temporary users in database and deleting them once they disconnect.
What are the ways I should go about doing this making sure users are not spam and duplicated?
=> First thing which came into my mind was IP address, but on little research and testing I was stuck on the fact that on my local server it always returned 127.0.0.1 IP address and that how can I test a second user on my same device while using localhost server?
=> Are there any other client details I can extract from Phoenix Socket which are client specific and can be used to make temporary users?

1 Like

An option to consider is using ReCaptcha v3 on the client side. It’ll help make sure that you aren’t swarmed by bots by giving you a basic guess about whether the end user is a human being or a program.

Are the real time chat users able to directly message regular users?

2 Likes

FWIW, you’ll likely want to look into a plug like remote_ip because most deployment environments will have load balancers etc involved.

That could also be handy for testing since you can add hand-crafted X-Forwarded-For headers.

2 Likes

That’s something I’ll surely look into for bot prevention!
So the chatting will be based on invites and accepting invitations, with some kind of limit on daily sent invites for temp users
Thank you very much for the necessary advice🙏

This was something I was looking for I suppose. Any references on how can I use these headers on a browser or localhost server at the same time on the same machine?
Btw I am on a Windows 11 machine

Got it!
For anyone else who is stuck in this, you can use ModHeader extension for adding any type of custom header for testing
Thank you @al2o3cr and @benwilson512 for the helpful guidance!
Love from India😇

2 Likes