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

Add /api/login endpoint and authentication middleware #37

Merged
merged 14 commits into from
Aug 27, 2021

Conversation

shangzhel
Copy link
Collaborator

@shangzhel shangzhel commented Aug 26, 2021

@shangzhel shangzhel added the enhancement New feature or request label Aug 26, 2021
@shangzhel shangzhel added this to the Sprint 1 milestone Aug 26, 2021
@shangzhel shangzhel added this to In progress in Sprint 1 via automation Aug 26, 2021
@shangzhel shangzhel self-assigned this Aug 26, 2021
@shangzhel shangzhel added this to Sprint 1 in Product backlog via automation Aug 26, 2021
@shangzhel
Copy link
Collaborator Author

As soon as this PR gets merged I will do #27 to show how to use the authenticated API router.

Sprint 1 automation moved this from In progress to In review Aug 27, 2021
Copy link
Owner

@chomosuke chomosuke left a comment

Choose a reason for hiding this comment

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

Update README.md's instruction of npm start, it seems like now a key of a certain length is required

Copy link
Collaborator

@waltervan00 waltervan00 left a comment

Choose a reason for hiding this comment

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

Authentication package seems complete. #29 can be resumed once merged.

@shangzhel
Copy link
Collaborator Author

shangzhel commented Aug 27, 2021

#29 can be resumed once merged.

Resumed? This PR completes #29, it will not need to resume.

@shangzhel shangzhel changed the title Create add /api/login endpoint and authentication middleware Add /api/login endpoint and authentication middleware Aug 27, 2021
Copy link
Owner

@chomosuke chomosuke left a comment

Choose a reason for hiding this comment

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

image

I tried to test it with post man but it said this.

I'm not actually sure if this is a bug or am I testing it wrong

@waltervan00
Copy link
Collaborator

#29 can be resumed once merged.

Resumed? This PR completes #29, it will not need to resume.

Apologies.

@chomosuke
Copy link
Owner

image

I tried to test it with post man but it said this.

I'm not actually sure if this is a bug or am I testing it wrong

I think the problem is that,

You ran login through auth as auth is used for all routes, which it fails as there's no cookies, and the it toss the error as it is designed to. But then the error also gets interpreted as an internal server error for some reason so.. yeah...

I don't know if the fact that you called use auth after /login would means login doesn't trigger auth though. Cause if the ordering matters than it's weird that auth even gets called in the first place. I tried to find example for this on the documentation but i found nothing

@shangzhel
Copy link
Collaborator Author

That's because your HTTP method is set to GET which falls through the login route. I do need to fix it though.

Copy link
Owner

@chomosuke chomosuke left a comment

Choose a reason for hiding this comment

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

lgtm

@shangzhel shangzhel merged commit 48dcf9a into master Aug 27, 2021
Sprint 1 automation moved this from In review to Done Aug 27, 2021
Product backlog automation moved this from Sprint 1 to Sprint 1 Done Aug 27, 2021
@shangzhel shangzhel deleted the shangzhel/login branch August 27, 2021 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Product backlog
  
Sprint 1 Done
Sprint 1
  
Done
Development

Successfully merging this pull request may close these issues.

Implement login endpoint -- POST @ api/login Implement authentication middleware
3 participants