Bedtimestory9

Bedtimestory9

So I’m working on a spending tracker app, and I want everyone gets to use the app without logging in as a user first. I also want the non-user to be able to save the data that only belongs to their device (using uuid or similar identifier), but how do I create a session based on this? Or do I need a session implementation at all?

Just in general, how do people approach non-user usage for their phone app?

I’ve been thinking and adding schema/functions for this problem for 2 days, really need your helps. Thanks!

Showing Posts 1 to 4

codeanpeace

codeanpeace

I’ve needed something similar in the past for an in person multiplayer game so that friends invited via a QR code could join and start playing immediately without signing up, but could create an account after the game ends to save the game data e.g. result, chat, stats, etc.

Given the low stakes and to keep things simple, I’d create and log each guest players into a new placeholder user account marked as a guest account and tied to the client’s session uuid when they scanned a QR that opened a url to join a specific active game e.g. myapp.com/join/[game-uuid].

That way retroactively creating an account meant adding some auth method whiling removing the guest account flag and vestigial session uuid. That guest flag also makes it simple for a cron job to delete unconverted guest accounts older than some threshold. In theory, you could use the presence of a session uuid to indicate a guest account… ¯\_(ツ)_/¯

Bedtimestory9

Bedtimestory9 OP

Your solution seems pretty good to me, but how do you verify that guest player is that particular guest? Or verify a session? I’m pretty new to Auth and have no knowledge on this, can you give me some pointers on how to manage this session?

rhcarvalho

rhcarvalho

You can look at the code generated by phx.gen.auth, lots of lessons to learn there. The generator is getting a big revamp on the upcoming Phoenix v1.8 release, focusing on magic-link authentication (worth looking at the newer code).

You could use the same or similar token-issuing and session management code. When a new user shows up you generate a session token, optionally an automatic guest user.

Having a guest user might makes things easier if you need to save state associated with a user_id. If you can / intend to save all temporary data on the session (cookie), then you could probably do without a user entity until they decide to create an account and then you can import the data from the session into the DB.

Bedtimestory9

Bedtimestory9 OP

I’ll use a guest user, it seems cleaner and no need to use cookie. And thanks for the pointers.

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews