Skip to content

Instantly share code, notes, and snippets.

@alikrc
Created February 3, 2015 11:18
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save alikrc/a225699f484903258ec5 to your computer and use it in GitHub Desktop.
Save alikrc/a225699f484903258ec5 to your computer and use it in GitHub Desktop.
ajax post with bearer token
$.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
});
@kumo70
Copy link

kumo70 commented Jul 23, 2023

Hi
Did you find answer to this question? I've similar problem....regards

@alikrc
Copy link
Author

alikrc commented Jul 25, 2023

@kumo70 Hi, this is ajax post with bearer token answer, already in simpliest form. I've created this 9 years ago, can be outdated. What is your problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment