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

Decouple session management of tokens from user data #354

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

oudeismetis
Copy link
Member

@oudeismetis oudeismetis commented Sep 13, 2024

What this does

Our current implementation is fine, but becomes a problem the moment you want to update the users stored info without also updating their token.

Current client statuses

Main problem is Vue.

Both React and React Native, don't depend on the user model for getting the token. Upon authentication we set the token in store as well as the userId.
Therefore the userId is used to fetch the user information with users/{userid}
However, since the user is returned by the auth call, we save that information in the query cache to avoid needing to call this endpoint, but the source of truth for the user information is always the server and not the store.

Checklist

  • Separate Vue calls for user data and user token
  • Refactor to have only 1 endpoint/model/shape have a token in it
  • Update Vue
  • Update React
  • Update React Native

How to test

Add user steps to achieve desired functionality for this feature.

@oudeismetis oudeismetis temporarily deployed to tn-spa-bootstrapper-pr-354 September 13, 2024 15:57 Inactive
@oudeismetis oudeismetis temporarily deployed to tn-spa-bootstrapper-pr-354 September 16, 2024 16:38 Inactive
@whusterj
Copy link
Member

@paribaker and @lakardion - You might be best equipped to help Ed with this one.

Copy link
Member

@lakardion lakardion Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved store to setup store which very much looks like a composobale

@lakardion
Copy link
Member

@oudeismetis I removed the coupling in Vue which was the only client that was having both user and token combined in the same state.
After the new endpoint for the token is ready we can update all the clients to use it.

So right now the two places we're getting a token for the app are login and sign-up.
For login we should just send the user and pass to get the token.
Then for sign-up we should do the post for creating the user and subsequently perform a login (aka get the token with the user and pass) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants