1
1
1001001 1112016-08-16 12:54:00
JavaScript
1001001 111, 2016-08-16 12:54:00

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');
//...

I will be grateful for any help.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
G
GreatRash, 2016-05-06
@kir_lab

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.

I
Ivan Bogachev, 2016-05-06
@sfi0zy

У вас скрипт выполняется раньше, чем создаются кнопки. Уберите его в конец body или заверните в

$( document ).ready(function() {
    // Your code
});

или любой аналог этого на чистом JS (без jQuery)

Сергей Горностаев, 2016-05-06
@sergey-gornostaev

function hid() {
    alert('hello');
}

document.addEventListener("DOMContentLoaded", function() {
    var one = document.getElementById('one');
    one.addEventListener('click', hid, false);
});

A
Alexey Skobkin, 2016-08-16
@IgorO2

What exactly is unclear? You pass the section in the request header in the apikeysame way as, say, the section User-Agent, Acceptetc.
Read something about HTTP .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question