-
-
Save scriptonian/8a0977fd581201b5a50f7db409b0654e to your computer and use it in GitHub Desktop.
ajax post with bearer token
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
url: "http://localhost:33460/api/Account/userinfo", | |
dataType: 'json', | |
data: { | |
foo: 'bar' | |
}, | |
success: function(data, status) { | |
return console.log("The returned data", data); | |
}, | |
beforeSend: function(xhr, settings) { xhr.setRequestHeader('Authorization','Bearer ' + tokenString ); } //set tokenString before send | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment