bobbypriambodo

bobbypriambodo

Hi, I’ve just released my first hex package today (yay!).

Phoenix.Token.Plug is a collection of plugs for Phoenix.Token-based authentication, useful for API calls. It’s a bit like Guardian, but designed to use Phoenix.Token instead of JWT. Currently it only supports verifying Authorization header and ensuring that a request is authenticated, which fits my use case, but there are more available and interesting capabilities yet to be discovered.

Usage instruction is on the GitHub readme. Do give feedbacks, issues, and PRs! :smile:

Showing Posts 1 to 9

OvermindDL1

OvermindDL1

Awesome! Just need a VerifyCookie to copy the VerifyHeader functionality and it is the basics of what is needed. :slight_smile:

OvermindDL1

OvermindDL1

And a way to customize the assign key to something other than :user as someone may already use :user or may want multiple lookups. :slight_smile:

EDIT: And a way to customize the callback function name too on EnsureAuthenticated. ^.^

chrismccord

chrismccord

Creator of Phoenix

Very nice! One recommendation I have is the community convention would be to not stomp the Phoenix namespace. So instead of Phoenix.Token.Plug, can you rename your project to PhoenixToken? Then the PhoenixToken.Plug module could be called as normal.

bobbypriambodo

bobbypriambodo OP

@OvermindDL1, thanks for the suggestions! I’ll see what I can do :slight_smile:

Oh, I must have missed the convention. My reference for naming it was this point on https://hex.pm/docs/publish:

If you are providing functionality on top of an existing package, consider using that package name as a prefix. For example, if you want to add authentication to Plug, consider calling your package plug_auth (or plug_somename) instead of auth (or somename).

Since I thought Phoenix.Token.Plug gives the verifying functionality to Phoenix.Token, that was what I went with. I probably misunderstood that point. I’ll rename it ASAP, thanks for the recommendation! :smile:

bobbypriambodo

bobbypriambodo OP

I’ve just published phoenix_token_plug v0.2.0, which renames the namespace to PhoenixTokenPlug. I figured I might as well merge the .Plug namespace since PhoenixToken wouldn’t have any functionality on its own (and neither would PhoenixToken.Plug). I’ve also added the functionality suggestions to the repo’s issues and will tackle it when I have the time.

Keep in mind that the API might still be unstable at this point :slight_smile:

OvermindDL1

OvermindDL1

Eeh, you never know, could end up writing more non-plug helpers for it or so. ^.^

/me is a fan of more namespaces.

bobbypriambodo

bobbypriambodo OP

At least I still have the PhoenixTokenPlug module for utility functions, or if it comes to it, possibly PhoenixTokenPlug.Utils? :wink: I guess we’ll see how it unfolds, naming things is hard.

bobbypriambodo

bobbypriambodo OP

I have an idea in mind, but I want to make sure first: how do you see this happening? Is it common to put stateless authentication tokens in their cookies, seeing as Plug.Session already has a solution for putting session data in and storing the key in cookies? And do you think that means we need VerifySession too (seeing as Guardian has one)? It would probably help if you provide some example use cases for it :slight_smile:

OvermindDL1

OvermindDL1

A VerifySession would probably make more sense yep.

— All posts loaded —

Where Next? Top

Trending in Announcing Top

type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
kip
I’ll shortly be launching Text, a nascent text analysis library. Current functionality In this early version (not ready for prime time) ...
New
kip
Following on from my CLDR lbraries I started work on Unicode transforms. But like everything related to CLDR there is a lot of yak-shavin...
New

Other Trending Topics Top

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
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews