Answer the question
In order to leave comments, you need to log in
Where should the parameter be passed in the "apikey" header when authorizing via API?
Good afternoon!
I'm trying to authorize via API
I can't understand where it is necessary to pass the apikey parameter in the header
class ApiKeyAuthenticator implements SimplePreAuthenticatorInterface
{
public function createToken(Request $request, $providerKey)
{
// look for an apikey query parameter
//$apiKey = $request->query->get('apikey');
// or if you want to use an "apikey" header, then do something like this:
$apiKey = $request->headers->get('apikey');
//...
Answer the question
In order to leave comments, you need to log in
At the time of the script execution, the DOM has not yet been formed. You either need to wait for the page to load (onload), or for the DOM to load (DOMContentLoaded), or place the script before the closing body.
У вас скрипт выполняется раньше, чем создаются кнопки. Уберите его в конец body или заверните в
$( document ).ready(function() {
// Your code
});
function hid() {
alert('hello');
}
document.addEventListener("DOMContentLoaded", function() {
var one = document.getElementById('one');
one.addEventListener('click', hid, false);
});
What exactly is unclear? You pass the section in the request header in the apikey
same way as, say, the section User-Agent
, Accept
etc.
Read something about HTTP .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question