BryanJBryce

BryanJBryce

Ash Authentication Phoenix: Password reset database failure

I have an app that I haven’t updated to Ash 3 yet and one that I have, the one that has been upgraded has an issue when I try to reset a password through the generated web UI.

The email works, but upon trying to set the new password this is the error message, something about jti conflict?

[info] POST /auth/user/password/reset
[debug] Processing with AppWeb.AuthController
Parameters: %{“_csrf_token” => “Z31dKwgdHydrQGQPJwFnexwldyAaB2EBPKmCGtFbZ32Kw4VMwC6TXk83”, “_method” => “POST”, “user” => %{“password” => “[FILTERED]”, “reset_token” => “eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY3QiOiJwYXNzd29yZF9yZXNldF93aXRoX3Bhc3N3b3JkIiwiYXVkIjoifj4gNC4wIiwiZXhwIjoxNzE1NzE4NzQzLCJpYXQiOjE3MTU0NTk1NDMsImlzcyI6IkFzaEF1dGhlbnRpY2F0aW9uIHY0LjAuMCIsImp0aSI6IjJ2NzhpbmU1dXUyMm04bWg0azAwMDBjMyIsIm5iZiI6MTcxNTQ1OTU0Mywic3ViIjoidXNlcj9pZD1iN2UyNjY0MC1iNzUxLTQ3ZjgtOGZhOS1lZjU0MDRiMmRjNmQifQ.c9X2nEuYcccuht7L8t7EYKyM3mLyoaUB3cctCBPsC2Q”}}
Pipelines: [:browser]
“supermotel.localhost”
“Set tenant to supermotel”
-----INSPECT-----
Tenant: “supermotel”
[debug] QUERY OK source=“users” db=1.8ms idle=1862.8ms
SELECT u0.“id”, u0.“email”, u0.“hashed_password” FROM “supermotel”.“users” AS u0 WHERE (u0.“id”::uuid = $1::uuid) [“b7e26640-b751-47f8-8fa9-ef5404b2dc6d”]
↳ anonymous fn/3 in AshPostgres.DataLayer.run_query/2, at: lib/data_layer.ex:696
[debug] QUERY OK db=0.2ms idle=1875.5ms
begin
↳ anonymous fn/3 in Ash.Changeset.with_hooks/3, at: lib/ash/changeset/changeset.ex:2918
[debug] QUERY OK source=“users” db=1.6ms
UPDATE “supermotel”.“users” AS u0 SET “hashed_password” = $1 WHERE (u0.“id” = $2) RETURNING u0.“id” [“$2b$12$anocOFCmCTrdwLOeOgSDuuUYskMd6wGuyxoxHj/MgYEUf69u5iwrS”, “b7e26640-b751-47f8-8fa9-ef5404b2dc6d”]
↳ AshPostgres.DataLayer.update/2, at: lib/data_layer.ex:2484
[debug] QUERY ERROR source=“tokens” db=0.0ms
INSERT INTO “tokens” AS t0 (“subject”,“created_at”,“expires_at”,“jti”,“purpose”,“updated_at”) VALUES ($1,$2,$3,$4,$5,$6) ON CONFLICT (“jti”) DO UPDATE SET “subject” = EXCLUDED.“subject”, “expires_at” = EXCLUDED.“expires_at”, “purpose” = EXCLUDED.“purpose”, “updated_at” = COALESCE(EXCLUDED.“updated_at”, $7) RETURNING “subject”,“jti”,“expires_at”,“purpose”,“extra_data”,“created_at”,“updated_at” [“user?id=b7e26640-b751-47f8-8fa9-ef5404b2dc6d”, ~U[2024-05-11 20:32:41.744782Z], ~U[2024-05-14 20:32:23Z], “2v78ine5uu22m8mh4k0000c3”, “revocation”, ~U[2024-05-11 20:32:41.743630Z], ~U[2024-05-11 20:32:41.744896Z]]
↳ AshPostgres.DataLayer.bulk_create/3, at: lib/data_layer.ex:1579
[debug] QUERY OK db=0.2ms
rollback

To the best of my knowledge this is exact setup as the Getting Started guide shows except for I’ve added Ash multitenency via a schema to my app.

Marked As Solved

zachdaniel

zachdaniel

Creator of Ash

Alright, I’ve just pushed a commit to ash_authentication that should fix this. Was an internal mechanical error :slight_smile:

You can try out main, or CI should cut a new release on its own once its done building.

Also Liked

BryanJBryce

BryanJBryce

@zachdaniel I updated to Ash 3.0, same issue. I built a project to reproduce without multitenency and it appears to be working, going to try with multitenency to see if it will reproduce.

zachdaniel

zachdaniel

Creator of Ash

I assume you’re doing something fancy to make this actually work, as IIRC it doesn’t work by default.

EDIT: got it working

Where Next?

Popular in Questions Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

Other popular topics Top

hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49266 226
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

We're in Beta

About us Mission Statement