Skip to content

Instantly share code, notes, and snippets.

@amoose
Last active December 29, 2015 05:19
Show Gist options
  • Save amoose/7621537 to your computer and use it in GitHub Desktop.
Save amoose/7621537 to your computer and use it in GitHub Desktop.
Snippet to authenticate a user and query MyUSA profile.\
$(function() {
OAuth.initialize('public key');
$('.login').click(function(e) {
e.preventDefault();
OAuth.popup('myusa', function(error, result) {
$.ajax({
url: 'http://my.usa.gov/api/profile?access_token='+result.access_token,
headers: { 'Authorization': "Bearer "+result.access_token },
success: function(data) {
console.log("result",data);
},
type: 'GET'
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment