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

Be able to have different strategies of session storage between logged users or anonymous ones #623

Open
5 tasks done
Will956 opened this issue Jul 1, 2024 · 0 comments

Comments

@Will956
Copy link
Contributor

Will956 commented Jul 1, 2024

Checklist

  • I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

We use this library to handle our sessions and store them in Redis. The drawback of that is those anonymous requests persist anonymous sessions in our Redis, and that can be huge (crawlers, scrapper, data scripts, etc...). We still want to persist those sessions somewhere because we attribute a session id for them.
Our Redis cluster is so full of anonymous session and we have memory issues.

Describe the ideal solution

I guess the ideal solution will be to have different storage strategies based on logged-in or anonymous users.

Alternatives and current workarounds

At the moment, we init different instances of this library based on cookie value: if we know that we have a cookie of a logged-in user, we init the auth middleware that has Redis configuration (so logged-in sessions are persisted within Redis). If we know that we have a cookie of anonymous users, we init the auth middleware that persists sessions within the cookie.

Additional context

Our workaround works, but it seems hacky and the logic to know if it's a cookie from a logged-in user or not is not fully bullet-proof.

Maybe I'm missing something here and there is an obvious way of achieving that without this complexity.

Thanks!

@Will956 Will956 changed the title Be able to have different strategies of session storage between logged or not Be able to have different strategies of session storage between logged users or anonymous ones Jul 1, 2024
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

No branches or pull requests

1 participant