“SetRequestHeader Authority Bearer” Réponses codées

SetRequestHeader Authority Bearer

var customXMLHttpRequest = (function (jwtoken) {

    function getXMLHttpRequest(method, url, async){
        var xmlHttpRequest = new XMLHttpRequest();
        xmlHttpRequest.open(method, url, async);
        xmlHttpRequest.setRequestHeader('Authorization', 'Bearer ' + jwtoken);
        return xmlHttpRequest;
    }

    return getXMLHttpRequest;
})('Your token');
Shadow

SetRequestHeader Authority Bearer

var params = 'name=intro_home&status=true';
var xhttp = new XMLHttpRequest();
xhttp.open("POST", process.env.API_URL + 'intro/save', true);
xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhttp.setRequestHeader('Authorization', localStorage.getItem('auth._token.laravelJWT'));
xhttp.onreadystatechange = function () {//Call a function when the state changes.
    if (xhttp.readyState == 4 && xhttp.status == 200) {
      alert('ok');
    }
  }
xhttp.send(params);
Shadow

Réponses similaires à “SetRequestHeader Authority Bearer”

Questions similaires à “SetRequestHeader Authority Bearer”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code