Last active
August 13, 2017 23:18
-
-
Save ivandevp/d4e719a4ecaf220ba792b0b04635d01b to your computer and use it in GitHub Desktop.
AJAX request to get authentication using Lyft API
This file contains 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
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