bnchrch

bnchrch

Auth0_jwks - I made an Auth0 plug so you don't have to!

Hey all,

I spent a good part of today battling with Auth0’s awkward documentation and muddy concepts trying to figure out how I can turn an access token from my web client into actionable user data on my API.

As a result I created a small plug to help the community avoid the pitfall I ran into trying to get this running. I hope you enjoy!

https://github.com/bechurch/auth0_jwks

P.s. I’ll put out a tutorial around this in a week or so

Most Liked

chulkilee

chulkilee

Welcome to the forum - and thanks for the contribution to the community :heart:

Quick notes

https://github.com/bechurch/auth0_jwks/blob/3584412a04ae8c5a1ed3be221cf51134db294155/lib/plug/validate_token.ex#L14-L21

Do you need to handle bearer not Bearer?

Note that “Bearer” is now case sensitive. Per original HTTP spec, auth scheme is case insensitive (RFC 2617 - HTTP Authentication: Basic and Digest Access Authentication) however “Basic” and “Bearer” are exceptions (see RFC 6750 - The OAuth 2.0 Authorization Framework: Bearer Token Usage)

In my case, I usually just accept the good request (Bearer) - then you can simplify this by pattern match on the string - "Bearer " <> token = header

Last Post!

Jono

Jono

Still excited about the tutorial! But the readme looks pretty informative - bravo!

Where Next?

Popular in Announcing Top

jakub-zawislak
Hi everyone, I’m coming from the Symfony (PHP) framework. I like Phoenix, but it has a one thing that was build much better in the Symfo...
New
mspanc
I am pleased to announce an initial release of the Membrane Framework - an Elixir-based framework with special focus on processing multim...
New
Qqwy
TypeCheck: Fast and flexible runtime type-checking for your Elixir projects. Core ideas Type- and function specifications are const...
336 14703 100
New
nikokozak
Hello all, I’ve been working on Svonix - a library for quickly integrating Svelte components into Phoenix views. It’s a much-needed succ...
New
type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
scohen
Lexical Lexical is a next-generation language server for the Elixir programming language. Features Context aware code completion As-you...
New
Flo0807
Hello everyone! I am excited to share our heart project Backpex with you. After building several Phoenix applications, we realized that...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31494 112
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40042 209
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New

We're in Beta

About us Mission Statement