Reputation: 3048
I am making a RestAPI for my website and I want to use an API Key as part of my authentication. Let's say I have a form where a user creates a comment. Am I supposed to pass in the apiKey with the url? For instance,
<form method="POST" action="http://example.com/api/v1/comment?apiKey=12345">
These seems insecure since anybody can just view the html and see the apiKey. So, how is this supposed to work? How are you supposed to use an APIKey for security?
Upvotes: 1
Views: 1022
Reputation: 146
You could use JavaScript/jQuery to do the post, which would allow you to add a HTTP header with your APIKey to the request.
Upvotes: 1