0

Ext.Ajax.request({ url: 'Employee/Search',
method: 'POST',
headers: { "Content-Type":"application/json","Accept": "application/json","Authorization": "OAuth oauth_token=158ghhBtgf2586525hggfgdf" },
jsonData: {
"FirstName": txtFirstName.getValue()
},
success: function(response) {
},
failure: function(response) {
}
});

This is giving me 401 (Unauthorized Request)

1 Answer 1

2

I am using adal.js library by Microsoft, and using the following code:

window.acquireTokenCallback = function (error, token) {
    if(error || !token) {
        Ext.alert('ADALERROR', error || 'Token empty');
        return;
    }
    // Apply token to all future Ajax requests.
    Ext.Ajax.setDefaultHeaders({
        'Authorization': 'Bearer ' + token,
        'Accept': 'application/json'
    });
    // Load Settings from Server.
    me.loadSettings();
};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.