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
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
I’ve followed the Phoenix LiveView file upload code here Uploads — Phoenix LiveView v1.0.0-rc.7 and so far everything works just fine wit...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #ai
- #iex
- #graphql
- #elixirconf-us
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
NobbZ
Because you are not showing full code? Perhaps do everything in an iex session.
hauleth
It seems that there is something happening in the meantime. Could you provide us with Minimal Complete and Verifiable Example? Because right now I can say that “it works on my machine”
greyhwndz
@NobbZ, @hauleth
My actual problem that led me to debugging that is the following line:
https://github.com/greyhwndz/library_api/blob/master/lib/library_api_web/controllers/session_controller.ex#L12
should return me a token after Postman POST
to
http://localhost:4000/api/sessionHowever, it falls into the
rescuesection that is why I tried debugging my render viewhauleth
This is neither minimal nor verifiable example. I still do not get where you put that inspect nor what are the types you are inspecting.
greyhwndz
Am sorry @hauleth for being a newbie.
I guess I will try to re-create a new thread and re-phrase my problem. Thanks for the guidance
alfredfriedrich
That is a JWT Token, paste it on jwt.io, but there’s no data inside. So I would guess you are using a JWT token library between your assignment and your
IO.inspect.benwilson512
No need to do this, just update here with more information and we’ll be able to provide a more detailed answer.
greyhwndz
Ok @benwilson512. trying now…
greyhwndz
@benwilson512, @NobbZ, @hauleth
I have the following code in
lib/library_api/library.exand in my SessionController
lib/library_api_web/controllers/session_controller.exand in my SessionView:
lib/library_api_web/views/session_view.exIn my database I already was able have the following data:
NOTE:
password&password_confirmationare virtual fieldsUsing Postman, I am trying to
POSTtohttp://localhost:4000/api/sessionthe ff. data:that should return a token.
Instead I encounter the following error in my iex console:
benwilson512
get_user_by_email!returns a%LibraryApi.Library.User{}not{:ok, %LibraryApi.Library.User{}}, so yourcasein your controller doesn’t match.Also, you probably know this, but never store user passwords in the database unhashed.