ashauthentication: possible bugs?
I have a couple errors coming up with AshAuthentication, not sure if they're bugs or me doing something wrong.
1) If I disable registration:
I get this error:
2) When I try to open a password reset link, I get the following error:
32 Replies
Auth config:
Lib versions:
I think the second one might be due to recent changes in
phoenix_live_view
that has more stringent checks on reserved assigns, like socket.🤔 interesting
ah, yeah
it looks like we're using
@socket
all over
damn
So:
1. make the form handle disabled registration
2. eliminate all usages of passing the @socket
around
well
Does that mean that @socket
is available everywhere and doesn't need to be provided?I haven't looked at the code, but based on why I would pass it around in stuff I've done before, I would guess it's for the Route helpers. If that's the case, they can also be passed the endpoint instead of the socket.
can you try that branch out?
Yeah, is there a trick to using an unmerged PR in mix?
just use the branch
component-fixes
OK, looks like the password reset link works now. Still getting an error on the login form if registration is disabled.
Oh, yeah right I didn’t fix that
I'm a bit confused by the set up there
Might need @jart to weigh in. It looks like we need to only show the register form if one of the actions supports it. But I feel like the typespecs don't line up with reality so I'm a bit confused. I can't find
AshAuthentication.Strategy.t()
The web error might be a little more helpful.

I think it needs to handle the action being nil because it doesn't exist when registration is disabled.
Yeah, but it should be disabled at a higher point
I.e not even rendering that component
Gotchya. Yeah, I have no familiarity w/ the codebase, so I'll probably stop guessing. 😅
Interesting, this also affects the migration generator:
Also getting a migration generator error, seems to happen whether or not I disable registration:
🤔
I wonder which attribute we're adding with
[]
as the valueCrashes before writing any files, so hard to say from my end.
Hmm…that warning wouldn’t cause a crash
Oh
So dumb sorry lol
I just looked at the warning
…do you have any check constraints?
Bog standard on the token:
User isn't too fancy:
I've already manually created the migrations, so it's not a huge rush to figure that one out.
Honestly I think that might be a different resource entirely
Oh, that's totally possible. Didn't even think of that, since I haven't been using the generator yet. I just wanted to figure out a diff for the auth stuff.
We loop over check constraints and check for an existing matching attribute
So never mind on that, will sleuth that on my own later. Only remaining issue w/ auth is disabling the registration in AshAuthenticationPhoenix. It's a pretty smooth experience so far, loving it! 😄
Hey folks. So the reason the socket gets passed around is for the otp_app that we pull from the endpoint.
But it seems like
@socket
is just always available anywayOkay that surprises me but ¯\_(ツ)_/¯
Same here
But if you try out the dev server on my branch it all works
It makes sense that it would blow up with registration disabled now that I think about it because AAP isn’t aware that that’s a thing and assumes that registration and sign in are always enabled.
Should be fixable in
Components.Password
Yeah, I was looking there, but have some questions.
I'm a bit confused about
strategy.resettable
and the Enum.any?
Also for the life of me I can't find this type:
Is that autogenerated by it being a protocol?
Trying to figure out how to do basically the same thing for if you can register1. Yeah it’s because resettable is an entity on the password strategy.
2. Yes, it’s generated by defprotocol.
ohhh I see. I have a hack for that:
If you have a "singleton" entity
but I think we need to make that config in the DSL really
okay so I should be able to fix that
Okay @frankdugan3 that branch should have that fix now
Success!

I also mixed in the stored tokens like you have on AshHQ, works perfect!
I'll mark this as solved and will keep an eye out for the PR getting merged/released.
🥳