Last active
August 31, 2015 17:20
-
-
Save boomtrain-support/1258b6b0224d028f011b to your computer and use it in GitHub Desktop.
API Authentication - An example authentication request using jQuery
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
<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