Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Is Storing Access_Token in Server-Side Cookies a Best Practice for API Validation? #463

Open
zuko-firelord opened this issue Dec 22, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@zuko-firelord
Copy link

zuko-firelord commented Dec 22, 2024

I am using Next.js 15 for the frontend and a Go backend. While reviewing the example of authorizer-nextjs, I noticed that the access_token is stored in a server-side cookie that can be use for validating API requests in middleware.
image

Is this approach secure and recommended?
If I decide not to store the access_token on server-side cookie, can I validate API requests using a session_token instead?

@zuko-firelord zuko-firelord added the bug Something isn't working label Dec 22, 2024
@zuko-firelord
Copy link
Author

@lakhansamani

@lakhansamani
Copy link
Contributor

@zuko-firelord yes u can also validate it using session_token, but make sure that cookie is present.

@zuko-firelord
Copy link
Author

@lakhansamani i couldnt find any function in authorizer-go related to validating APIs using the session_token. could you let me know the name of the function?

@zuko-firelord
Copy link
Author

i want to raise a PR for an example of authorizer-nextjs15 with middleware functionality and implement the backend authorize API. im not good at frontend stuff, but i'll give it a shot. Where should I push my code?

@lakhansamani
Copy link
Contributor

@zuko-firelord thanks
you can create PR here: https://github.com/authorizerdev/examples

@zuko-firelord
Copy link
Author

@zuko-firelord thanks you can create PR here: https://github.com/authorizerdev/examples

ive raised a pr...please cross-check that logics are correct, did it very short amt of time...pardon me for ui

@zuko-firelord
Copy link
Author

@lakhansamani i couldnt find any function in authorizer-go related to validating APIs using the session_token. could you let me know the name of the function?

?

@lakhansamani
Copy link
Contributor

lakhansamani commented Dec 28, 2024

@zuko-firelord there is API
https://docs.authorizer.dev/core/graphql-api#validate_session

However this needs cookie and token cannot be passed in request and will return new session for security reasons.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants