Skip to content

Instantly share code, notes, and snippets.

@boomtrain-support
Last active August 31, 2015 17:20
Show Gist options
  • Save boomtrain-support/1258b6b0224d028f011b to your computer and use it in GitHub Desktop.
Save boomtrain-support/1258b6b0224d028f011b to your computer and use it in GitHub Desktop.
API Authentication - An example authentication request using jQuery
<script>
// Use the OAuth Token with another request
function useToken() {
//Send a jQuery AJAX request
$.ajax({
url: 'https://api.boomtrain.com/{endpoint}',
// Replace with your Username and App Id,
// using the OAuth Token in place of your Password
headers: {
'x-app-id': '{app_id}',
'Authentication': 'Basic ' + btoa('{username}:{oauth_token}')
},
type: '{HTTP Method}',
success: function(msg) {
console.log(msg);
}
});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment