ash_authentication update totally breaks a signed in user
If i was already logged in, i get redirected to the login page, but it's perptually redirecting me with the attached log
22 Replies
the first two lines look very suspicious -
HomeLive.nil
? and there's no loop there, what do you mean by perpetually redirecting?The load from session plug should clear the session on a failed attempt to sign in
I tested this scenario as well and didn't have any issues like this. What exact change did you make?
Did you remove the params from that last Ecto query log? Or is it actually sending a bunch of commas like that?
here's by browser pipeline:
yes, i also agree, hence i was a bit confused? If i use incognito mode, i have no issues, can login, no issues. but my existing session in google chrome is having this issue after making the changes and i'm not sure.
this happened when i upgraded to the latest version of ash_authentication with the changes to using :
jti
and requiring. Here's my tokens section:
What does the browser request logs look like?
Essentially, you should be getting into this code: |> Conn.assign(current_subject_name, nil)
GitHub
ash_authentication/lib/ash_authentication/plug/helpers.ex at df19f1...
The Ash Authentication framework. Contribute to team-alembic/ash_authentication development by creating an account on GitHub.
I'm experiencing the same issue described above. I've found that the
:live_user_required
hook evaluates to false
I only added the require_token_presence_for_authentication? true
line. Have not set the session_identifier
So, does this mean that the user session is not being cleared?
This logic here:
Note the
Conn.delete_session
that should be deleting the session that holds the now invalid session key
When you look at the storage, is that happening properly?If I understand you correctly, I'm now looking at the
tokens
table in the database. I just cleared the rows in that table, went thru the sign-in workflow, and was redirected back to the home page. The table now has one row as follows:
From this block, the call to TokenResource.Actions.get_token\3
returns {:ok, []}
which doesn't match the with
pattern correctly
all of my token purposes in this table are revocation
So that not matching the with pattern should be clearing your session
Then when you get redirected, you should only be redirected one time
yes, the session is getting cleared, but this shouldn't be the case immediately after signing in
I might be misunderstanding, but when I read the line
I expect that the row representing the session I just established thru the sign-in process should have a value of
user
on the purpose
column. This is not the case. Instead, that column has a value revocation
.this might be interesting. the
INSERT INTO
query from my sign_in_with_token
action inserts a JTI value of 315m73fqvfks1amh3k000201
while the SELECT
query used to search for the token is searching for a JTI value of 315m73g6shcs0sotn0000354
The session should get cleared when the session value is invalid
So when the user comes in with a session that is no longer valid it gets cleared and they should be redirected to sign in
We're going to have to get this reproduced I think
Please make an application using the installer and set the session identifier to
:unsafe
To reproduce this issue and confirm that it's an issue with ash authentication and not in some way with your implementationI created a project from scratch and there is a row in the
tokens
table with a purpose
of user
. I can correctly log in and out.
I've found the issue. In the old project, authentication.tokens.store_all_tokens?
was not configured to be true
Hmm...that shouldn't be required, so that's interesting.
So you're saying without that setting you get an infinite redirect loop?
For me, it's not an infinite redirect loop
Oh
It's supposed to logout current users
That's a side effect of the change
Maybe my issue was different than the original post
There was no token stored with a
user
purpose until I enable that config setting
What would have caused an infinite loop is if my home page required user authentication
But I don't have it set up that wayThere doesn't have to be a token with a user purpose unless that setting is enabled
So whatever you experienced it doesn't sound like a bug, just expected behavior?
for the time being: we ended up just asking users to go to
/sign-out
to log out, then logging back in doens't have this issue.
I'm not sure what happened but i was in a bottomless loop, as stated above.
Sorry about the late reply. So the main issue is old sessions after adding in those two lines had the boot loop and singing out and signing back in seems to fix the issue. Removing the line and using the unsafe will also not have the boot loop.😲😖
I never saw that so there is only so much I can do unfortunately
it's all good 🙂
the great thing about having not many users: you can let them be the guinea pig 😉