Skip to content

Instantly share code, notes, and snippets.

@ivandevp
Last active August 13, 2017 23:18
Show Gist options
  • Save ivandevp/d4e719a4ecaf220ba792b0b04635d01b to your computer and use it in GitHub Desktop.
Save ivandevp/d4e719a4ecaf220ba792b0b04635d01b to your computer and use it in GitHub Desktop.
AJAX request to get authentication using Lyft API
var clientId = '<your_client_id_here>';
var clientSecret = '<your_client_secret_here>';
$.ajax({
url: 'https://api.lyft.com/oauth/token',
type: 'POST',
data: {
grant_type: 'client_credentials',
scope: 'public'
},
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic " + btoa(clientId + ":" + clientSecret));
},
success: function(response) {
console.log(response);
},
error: function(error) {
console.log(error);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment