greyhwndz
Hello everyone!
Can somebody help me understanding the following…
Why is it that:
mydata = %{id: user.id, email: user.email, username: user.username}
IO.inspect mydata
jwt = %{data: mydata, sub: user.id}
results in
iex(1)> %{email: "maria@hello.com", id: 4, username: "maria"}
while:
mydata = %{id: user.id, email: user.email, username: user.username}
jwt = %{data: mydata, sub: user.id}
IO.inspect mydata
results in
iex(1)> {:ok,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.B0QRhfQku78gSaxGoC8sxcKVL1wScNCAQGU_lzV4sQ8",
%{}}
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
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
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 33 to 24- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
greyhwndz
I guess @NobbZ I was referring to somewhat like a typesafety advantage that is
NobbZ
It is basically the same as an imaginary
user when is_struct(user, User) -> ….I’m not sure what you otherwise mean by " offering the same advantage as somewhat like ensuring that the input is of the same
Userstruct".greyhwndz
yes @NobbZ thank you so much!
Is
user = %User{} ->offering the same advantage as somewhat like ensuring that the input is of the sameUserstruct?NobbZ
The
usercase as the most generic clause has to come last, alternatively you could make ituser = %User{}or something similar.benwilson512
I’m not a JWT power user or anything but can’t you just do
greyhwndz
I actually already have gone thru the documentation but what I can’t seem to do is the conversion of
into a format that I can easily convert into
should I add each claim one by one lilke
?
benwilson512
Yes, after you create that module in accordance with the Joken docs.
greyhwndz
So with my case it should be
?
benwilson512
Right, so your issue is that Joken — Joken v2.6.2 isn’t really built to be called explicitly, the docs call for you to have a
MyApp.Tokenmodule that handles this stuff. The first arg to Joken — Joken v2.6.2 is the token configuration. If you look at some examples you’ll see that if you want to encode stuff like the user id and email that should be done as so:greyhwndz
Joken 2.0 @benwilson512