Educado-App / educado-frontend

The repository for the educado content creation web platform.
https://app.educado.com
GNU General Public License v3.0
0 stars 4 forks source link

Potential Issue with Token Being Deleted/Overridden #15

Open Adachigaming opened 11 months ago

Adachigaming commented 11 months ago

Issue Description

Upon Accessing a site, one might find that the Token set by logging in will be gone. This is due to an old function defined in the the file app/src/contexts/useAuthStore.ts called useToken(), that is called to define the token as const token = useToken();.

To remedy this issue, simply define the token as const token = localStorage.getItem("token");. This will get the token directly from the storage, and can be easily implemented across all pages.

Steps to Reproduce

  1. Log in to the application with valid credentials. This sets an authentication token in the local storage
  2. Access a route that uses the useToken() function, and the Token will be removed.

Expected Behavior

Upon accessing the affected route, the applications should simply allow the user to view the page.

Actual Behavior

Upon accessing the affected route, the user is effectively logged out, as they do not have a token anymore, and are redirected back to the Login page.

Additional Information

MortenMunk commented 11 months ago

@Adachigaming You have not assigned anyone to this issue. It may help get the attention of the team, if you assign members of the team in charge of web login.