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

Issue with implementing token refresh functionality #1419

Closed
chandel-aman opened this issue Nov 4, 2023 · 6 comments · Fixed by #1426
Closed

Issue with implementing token refresh functionality #1419

chandel-aman opened this issue Nov 4, 2023 · 6 comments · Fixed by #1426
Assignees
Labels
bug Something isn't working no-issue-activity No issue activity security Security fix

Comments

@chandel-aman
Copy link
Contributor

Describe the bug
Currently, the talawa-api lacks the functionality to handle token refresh using the provided refreshToken. The missing functionalities include but are not limited to saving the refreshed tokens in the database, revoking tokens after single use, and implementing security measures for secure token exchange.

To Reproduce
Steps to reproduce the behavior:

  1. Login a user.
  2. Check the database if the refresh token has been stored in user document (it is not getting stored now).
  3. Let the user get logged out automatically after the access token has expired.
  4. Check if a new refresh and access token is generated and set to the user.

Expected behavior

  1. Save refreshed tokens in the database.
  2. Revoke used tokens after a single exchange.
  3. Send the newly generated access token and refresh token to the user.

Actual behavior
The talawa-api code currently lacks the aforementioned functionalities for token refresh, leading to an inability to perform the intended token exchange.

Screenshots
N/A

Additional details
The token refresh functionality in the talawa-api is partially implemented but lacks the final steps for saving tokens in the database, revocation after single use, and implementing essential security measures.

Potential internship candidates
Please read this if you are planning to apply for a Palisadoes Foundation internship PalisadoesFoundation/talawa#359

@chandel-aman chandel-aman added the bug Something isn't working label Nov 4, 2023
@github-actions github-actions bot added security Security fix unapproved Unapproved for Pull Request labels Nov 4, 2023
@chandel-aman
Copy link
Contributor Author

@palisadoes please assign me this issue

Copy link

github-actions bot commented Nov 4, 2023

Congratulations on making your first Issue! 🎊 If you haven't already, check out our Contributing Guidelines and Issue Reporting Guidelines to ensure that you are following our guidelines for contributing and making issues.

@palisadoes
Copy link
Contributor

@rishav-jha-mech @kb-0311 Please comment on this.

@palisadoes palisadoes removed the unapproved Unapproved for Pull Request label Nov 5, 2023
@chandel-aman
Copy link
Contributor Author

@palisadoes @kb-0311

I've added an environment variable in env file.

Added/Modified:
NODE_ENV - This variable is now used to determine the development or production environment.

NODE_ENV=development

Purpose:

  • To check the environment and restrict access to the backend server. If NODE_ENV is set to 'production', the backend will only allow requests from specified origins, such as talawa-admin.

Note: No changes are required in the README since the default value is clearly specified.

So should I update the sample env too?

@kb-0311
Copy link
Contributor

kb-0311 commented Nov 14, 2023

Yes add them in the sample file too.

Copy link

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

@github-actions github-actions bot added the no-issue-activity No issue activity label Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-issue-activity No issue activity security Security fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants