3 years ago

Token + Domain Authentication?

Posted 3 years ago by xdega

So I began working on my very first API-First web app project. I have managed to get basic token authentication working, with a separate "token" table for managing API tokens, but I have a problem.

Currently, the URL request works as such: http://localhost/api/v1/?api_token={token}

This is nice, but what I want to do, is have the authentication require TWO parameters, i.e: http://localhost/api/v1/?domain={domain}&api_token={token}

In other words, I don't simply want a user to be able to authenticate by using ANY valid key in the token table. I want them to authenticate using a valid Domain:Key pair (the token table contains both domain and key fields).

I looked around and couldn't find anything that specifically tells me how to make this amendment to the HTTP basic auth. I would rather not deep edit the Laravel code. What is the best way for me to go ahead and accomplish this?

Please sign in or create an account to participate in this conversation.