Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't error if '__session' cookie is missing #1

Conversation

joseph-lozano
Copy link
Contributor

With the current implementation, if the user is not signed in, the application fails with the following error:

[error] ** (FunctionClauseError) no function clause matching in Joken.verify/3
    (joken 2.6.1) lib/joken.ex:247: Joken.verify(nil, nil, [{JokenJwks, [strategy: Clerk.Session.FetchingStrategy]}, Clerk.Session])
    (joken 2.6.1) lib/joken.ex:299: Joken.verify_and_validate/5
    (clerk 1.0.0) lib/authentication_plug.ex:17: Clerk.AuthenticationPlug.call/2

This is because nil is getting passed into Joken.verify/3. Instead, if the __session cookie is missing, we just should respond with a 401 unauthorized, so that the server does not return a 500 response.

@nathanjohnson320 nathanjohnson320 merged commit aab0206 into nathanjohnson320:main Apr 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants