giusdp

giusdp

Hi everyone,

I’m finding myself kinda paralyzed over this issue of authenticating (signup/login) an user in my Liveview+Supabase project. Mostly due to where to put the access_token (and refresh) that supabase gives me.

Supabase offers its own auth system with an api on top for user registration/login, it uses JWTs. In my project I have an UserController that calls the login endpoint with the credentials provided. I’m unsure if this is a good approach cause here the client sends the credentials to the server, the server calls the supabase api and gets the access_token, then where to store this access_token?

I’m using ecto with supabase so it’s kinda seamless from using any other postgres db (which is awesome), but I’m stuck on how to use and store these access_tokens for future queries after I login.

Perhaps should I just ignore the auth system and do it myself with phx.gen.auth and create my own users tables on the supabase postgres?

Showing Posts 1 to 4

giusdp

giusdp OP

I’m thinking about just dropping the Auth api from supabase and use it as a pure Postgres DB with ecto. So I will just use phx.gen.auth for my auth system. At that point I’m not sure if it’s convenient to still use supabase instead of my own DB, but money-wise it seems it’s still better to use supabase. It has a free tier and a 25$ tier, while most hosting solutions cost way more to just reach the hardware in the 25$ tier.

conradfr

conradfr

I had recently the same question but with Firebase.

Where I’m at now is that I use Firebase only to log in the user (keeping it client side via a LiveView hook), verify the returned JWT at the backend level and then use Guardian and its own generated JWT to keep the user logged. That way I use Guardian plugs & helpers.

It’s a bit involved, especially as Phoenix doesn’t have built-in auth(s) support but it seems to work OK.

As for LiveView I stumbled upon “live_session” randomly and it’s useful. Read Live sessions in action · The Phoenix Files to know more.

To be honest if I only wanted to support email/password I would have probably used the (meh) Phoenix auth generator.

giusdp

giusdp OP

I think I was in the direction of your solution. After a day of confusion I thought about using the auth api on the client side and pass the access_token to the server, then use it somehow to authenticate the user in my app for the routes. I found out about guardian to do authentication as well. Then I backtracked and gave up on the auth api cause I was getting nowhere.

Knowing someone else went through the same problems and managed to make it work gives me confidence to try it again. So thanks for the reply! I think I will go the same route so I can take advantace of the social logins and so on.

Debian3

Debian3

Have you ever made progress on this? I feel like supabase auth have all the batteries included and I’m unsure how to integrate that with the gen.auth.

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

CodeSync
Just a reminder for anyone still on the fence: early bird pricing for Code BEAM Europe closes on 8 September at 23:59 CEST. This is the l...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
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

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews