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

API: Add logout endpoint #223

Closed
rajdip-b opened this issue May 18, 2024 · 15 comments · Fixed by #581
Closed

API: Add logout endpoint #223

rajdip-b opened this issue May 18, 2024 · 15 comments · Fixed by #581
Labels
good first issue Good for newcomers priority: high scope: api Everything related to the API type: feature Release drafter tag for tagging PRs related to adding new features

Comments

@rajdip-b
Copy link
Member

Description

Add an endpoint to log out. The functionality will be very simple - just clear the token cookie.

Solution

  • Add a controller in auth controller.
  • Do not add @Public to it.
  • Create a service function that will unset the token cookie.
@rajdip-b rajdip-b added good first issue Good for newcomers scope: api Everything related to the API type: feature Release drafter tag for tagging PRs related to adding new features priority: high labels May 18, 2024
@rajdip-b rajdip-b moved this to Todo in keyshade-api May 18, 2024
@lakshay-saini-au8
Copy link
Contributor

/attempt

Copy link

github-actions bot commented Jun 6, 2024

Assigned the issue to you!

@rajdip-b rajdip-b moved this from Todo to In progress in keyshade-api Jun 6, 2024
@rashmod
Copy link

rashmod commented Sep 4, 2024

@lakshay-saini-au8 Are you still working on this, or should I take it on?

@rajdip-b
Copy link
Member Author

rajdip-b commented Sep 4, 2024

@rashmod you can get started with this one. It has been quite a long time since I've made the assignment

@rashmod
Copy link

rashmod commented Sep 5, 2024

The link for postman collection in docs in the API testing sections is broken

Also, you did not assign issue to me

@rajdip-b

@rajdip-b
Copy link
Member Author

rajdip-b commented Sep 5, 2024

I'm getting them fixed in a min.

EDIT: Done fixing.

@rajdip-b rajdip-b assigned rashmod and unassigned lakshay-saini-au8 Sep 5, 2024
@rashmod
Copy link

rashmod commented Sep 5, 2024

I'm looking to test the logout API endpoint, but I noticed that we don't have a traditional email and password login—just Google and GitHub OAuth. Would I need to run the frontend to test it, or am I missing something?
@rajdip-b

@rajdip-b
Copy link
Member Author

rajdip-b commented Sep 5, 2024

We have email+OTP auth aswell. Whenever the login is successful, we are setting the jwt token in the cookie of the response. Further requests make use of this cookie when making a request.

You would need to implement a logic that will unset this cookie value.

@rashmod
Copy link

rashmod commented Sep 6, 2024

the precommit hook is failing because of the lining rules
but it is not failing for any of my changes but instead in app/web

@rajdip-b
Copy link
Member Author

rajdip-b commented Sep 6, 2024

Yes, we are aware of this issue. The only way for us would be to disable the pro-commit hooks for now.

But for your end, you can use --no-verify flag along with git commit to bypass hooks.

@rashmod rashmod mentioned this issue Sep 13, 2024
10 tasks
@rajdip-b rajdip-b moved this from In progress to Todo in keyshade-api Nov 13, 2024
@rajdip-b rajdip-b moved this from Todo to Backlog in keyshade-api Nov 13, 2024
@ShreyamKundu
Copy link
Contributor

@rajdip-b I'm trying this and, as you mentioned, not adding @public(). However, when I test the /api/auth/logout route, I’m getting this:
{
"message": "Onboarding not finished",
"error": "Unauthorized",
"statusCode": 401
}

To avoid this, can I use BypassOnboarding?

@rajdip-b
Copy link
Member Author

rajdip-b commented Dec 7, 2024

I don't think that should be done since users wont have the option to log out before their onboarding is finished.

@ShreyamKundu
Copy link
Contributor

Any suggestions how to tackle this problem?

@rajdip-b
Copy link
Member Author

rajdip-b commented Dec 7, 2024

That's a feature, not a problem. Once you authenticate yourself, you would need to use the "Update User" request in Bruno and set isOnboardingFinished flag to true. After that, all the operations would be unlocked.

@ShreyamKundu
Copy link
Contributor

Okay I got it.

@rajdip-b rajdip-b moved this from Backlog to Under review in keyshade-api Dec 7, 2024
@github-project-automation github-project-automation bot moved this from Under review to Done in keyshade-api Dec 8, 2024
@rajdip-b rajdip-b moved this from Done to Queued for release in keyshade-api Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers priority: high scope: api Everything related to the API type: feature Release drafter tag for tagging PRs related to adding new features
Projects
Status: Queued for release
4 participants