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

wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
handnot2
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application. This library uses Erlang esaml to provide plug enabl...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 11030 135
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New
woylie
Phoenix components for pagination, sortable tables and filter forms with Flop and (optionally) Ecto. pagination cursor pagination sorta...
New

Other Trending Topics Top

mudasobwa
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews