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
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
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
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 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.