Authenticate HTTP Post requests
Unanswered
Spectacled bear posted this in #help-forum
Spectacled bearOP
We made a Unity game and send the highscore and user name to our nextjs api routes to write from there to our database. Now we are wondering how we can protect this endpoint? Is there an official implemenation to protect route endpoints with middleware for this usecase?
4 Replies
you can check a key for example inside your route handler. Only your game knows this key and the key will be checked whenever there is a new highscore
@Spectacled bear solved? please mark solution
Spectacled bearOP
Thanks for the input!
We were thinking about doing what you said, but will be needing to set up encryptions too, since we can’t use https.
I was wondering if there is an official „next“ way like using middle ware or a part of the documentation.
We were thinking about doing what you said, but will be needing to set up encryptions too, since we can’t use https.
I was wondering if there is an official „next“ way like using middle ware or a part of the documentation.
@Spectacled bear Thanks for the input!
We were thinking about doing what you said, but will be needing to set up encryptions too, since we can’t use https.
I was wondering if there is an official „next“ way like using middle ware or a part of the documentation.
yea, the route handler itself is reachable via https with next. That's what next provides (a https connection). But if you can't use https, that might be an issue 🤔