Kabawo

Kabawo

Hi. I am new to Elixir and I’m trying to build a REST api as a hobby/ learning project. The recommendation I found in the forums for implementing auth is to go the phx.gen.auth route and amend as necessary to suit REST workflow (I suspect Phoenix.Token would be of help here). Because I generated the project with --no-html --no-assets flags it seems the phx.gen.auth is not available. Can I ask what is the recommended solution in such case? Would I have to add html (I wanted to keep the project lean)? Would I build the auth from scratch using Phoenix.Token (I imagine as a plug)? Or maybe this is too much to implement and properly set up for a beginner? I am not a commercial programmer and I’ve had limited exposure to auth implementations (Python Flask, Flask-RESTful and FastAPI) and following the guides and sample/ toy projects for these technologies adding auth seemed fairly trivial (with the complexity hidden within libraries), so I am quite surprised to hit a bit of a roadblock in Phoenix. Thanks in advance for any help

Showing Posts 1 to 2

100phlecs

100phlecs

The sooner you get acquainted with Plug and its functions the better off you’ll be, as you’ll see how Phoenix builds on-top of it.

So yes, you would build the Auth from scratch with a Plug using Phoenix.Token.

Here are some guides that I think would be useful as reference.

If you don’t want to roll your own, then guardian may be what you’re interested in using, which can hide some of the implementation details like the previous languages you’ve worked with.

There are other auth libraries to use as well. I can’t vouch for any of them. I’ve not used Guardian before, but looking around the forum Guardian is the one I see come up.

Kabawo

Kabawo OP

Thanks for a quick response and the necessary resources.

I did come across guardian and some other propositions, but I think I’ve read Jose Valim saying that in this case the best library is no library (hence the auth generator). My only worry was that as a noob I may miss on some edge cases building it from scratch as a Plug. I guess I will give it a try and I’ll treat guardian as a fallback alternative.
Thanks for help

— 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
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
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
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
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
jaybe78
Hello, I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter). The diffic...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
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
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New
aseigo
ICal is a library for interacting with iCalendar data. It parses iCalendars into typed Elixir structs via ICal.from_ics, and can prepare ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews