bounswe / bounswe2022group4

6 stars 3 forks source link

Frontend: Authentication Token Local Storage #590

Closed umutdenizsenerr closed 1 year ago

umutdenizsenerr commented 1 year ago

Description:

In our medical experience sharing platform, we currently store the authentication token in the React state. However, when the user refreshes the page or closes the tab, the token is lost.

I would like to implement a solution to store the token in the user's browser using local storage, so that the token persists even after the page is refreshed or the tab is closed. The token should be stored when the user signs in, and deleted when the user signs out.

Steps:

1) Modify the SignInPage component to save the authentication token to local storage when the user signs in. We can use the localStorage.setItem method to save the token.

2) Modify the App component to retrieve the token from local storage when the page is refreshed or the tab is closed. We can use the localStorage.getItem method to retrieve the token.

3) Modify the App component to delete the token from local storage when the user signs out. We can use the localStorage.removeItem method to delete the token.

4) Test the implementation to ensure that the authentication token is stored and deleted from local storage as expected.

Reviewer: @BeratDamar Deadline: 26.12.2022 23.59

umutdenizsenerr commented 1 year ago

Since PR is merged, i am closing the issue.