-2
How do I hide this information that I pass as a parameter to the token request? the way anyone can see and cannot
var chaveToken = {
"grant_type": "password",
"username": "[email protected]",
"password": "xxxxxxxxxx@121111"
};
var token;
$.ajax({
url: 'http:/xxxxxx.com.br/token',
async: false,
contentType: 'application/x-www-form-urlencoded',
type: 'POST',
data: chaveToken,
success: function (data) {
token = data.access_token);
}
});
$.ajax({
url: 'http://xxxxxx.com.br/obterlistasreembolso',
async: false,
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', 'bearer ' + Token);
},
success: function (data) {
bla bla bla
}
});
If you cannot expose the data, do not use this API by Javascript. Request with a server-side language.
– bfavaretto
Maybe I was not clear in the previous comment: in JS there will be no way to hide this data.
– bfavaretto