Last active
December 29, 2015 05:19
-
-
Save amoose/7621537 to your computer and use it in GitHub Desktop.
Snippet to authenticate a user and query MyUSA profile.\
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
$(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