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

Feat: basic middleware structure to support authenticating requests #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JacobWithACapitalJ
Copy link

No description provided.

@vercel
Copy link

vercel bot commented May 19, 2022

Someone is attempting to deploy a commit to a Personal Account owned by @Jomy10 on Vercel.

@Jomy10 first needs to authorize it.

@vercel
Copy link

vercel bot commented May 19, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
polls ✅ Ready (Inspect) Visit Preview May 19, 2022 at 10:33PM (UTC)

@Jomy10
Copy link
Owner

Jomy10 commented May 19, 2022

Awesome! I'll test this out tomorrow. Only problem right now will be deployment to Vercel, as Vercel looks at the api directory for serverless functions. So we'll have to figure out how to get this working on Vercel.

@Jomy10 Jomy10 linked an issue May 19, 2022 that may be closed by this pull request
@Jomy10 Jomy10 marked this pull request as ready for review May 21, 2022 10:37
@Jomy10 Jomy10 self-requested a review May 21, 2022 10:37
Copy link
Owner

@Jomy10 Jomy10 left a comment

Choose a reason for hiding this comment

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

Alright. I've reviewed the pull request, I'll merge it after this question:

How do we generate the X-Poll-Token on the client?

@JacobWithACapitalJ
Copy link
Author

Alright. I've reviewed the pull request, I'll merge it after this question:

How do we generate the X-Poll-Token on the client?

Sorry, been a bit tied up with work recently! I'll implement the token generation on the weekend.
My idea of the auth flow is:
user inputs poll ID -> token is generated with a random ID and returned from /info endpoint -> user votes -> token is validated before writing vote to DB (with the tokens ID) -> user tries to vote again -> vote endpoint looksup votes with that token ID and rejects if documents are returned

@Jomy10
Copy link
Owner

Jomy10 commented May 24, 2022

That sounds good to me!

Let me know if you need anything.

P.S. Don't worry, there's no hurry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add protection against multiple votes per person
2 participants