ryanswapp

ryanswapp

This is the third post in a series on building a GraphQL API in Phoenix with Absinthe. In this post I cover authentication with Guardian.

https://ryanswapp.com/2016/12/06/phoenix-graphql-tutorial-with-absinthe-authentication-with-guardian/

Showing Posts 1 to 10

Anichale

Anichale

Awesome stuff man.

hlx

hlx

Great article Ryan!

What do you think of this code? It’s similar to yours but I pattern match on a valid changeset in the function instead of doing a extra case inside the function.

https://gist.github.com/hl/2ff2e3e8ef71bb8b45e8fa52eabbcb53#file-user-ex-L30-L31

hlx

hlx

Also since you are using Guardian you can build your context.ex like this

https://gist.github.com/hl/6372b3e376ff6a25fa80d39db73e6ab4

ryanswapp

ryanswapp OP

Thanks!

ryanswapp

ryanswapp OP

Ah ya! That’s nice. I assume you have used Guardian.Plug.LoadResource in the router pipeline right? Much cleaner. Thanks for sharing!

ryanswapp

ryanswapp OP

Cool, thanks again for sharing. I updated the post!

wfgilman

wfgilman

This is great. Looking forward to seeing more! :+1:

nando_chistaco

nando_chistaco

Ryan, thanks a lot for these three awesome posts. I’ve enjoyed them a lot and definitely posts like yours are very valuable for the Elixir community :ok_hand:

In this last one i’ve been able to catch a couple of typos (what an honour!!): in mix.exs and web/plugs/context.ex you use PhoenixGraphQL instead of MyApp as you do everywhere else.

Have an amazing 2017, you deserve it!!

ryanswapp

ryanswapp OP

Thanks for catching those! :grinning: I’ll get them fixed.

I hope you have a wonderful 2017 too!

Where Next? Top

Trending in Discussions 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
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
achempion
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
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
jtormey
Lately I’ve been thinking about how to organize components as a LiveView application grows. One of the pain points I’ve found (for myself...
New
Null-logic-0
What IDE or editor are you using for Elixir development? Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New

Other Trending Topics Top

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
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
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
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews