Skip to content

Instantly share code, notes, and snippets.

@pwim
Created June 26, 2017 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwim/85878421b10acf273908dbd1d24e0f73 to your computer and use it in GitHub Desktop.
Save pwim/85878421b10acf273908dbd1d24e0f73 to your computer and use it in GitHub Desktop.
Example of using cors with Doorkeeper API
<html>
<head>
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script type="text/javascript">
$.ajax({
dataType: "json",
url: "https://api.doorkeeper.jp/events",
headers: { 'Authorization': 'Bearer your_token' },
data: {},
success: function(data) {
$( document ).ready(function(){
$( "code" ).text( JSON.stringify(data) )
})
}
});
</script>
</head>
<body>
<h1>API Response</h1>
<code></code>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment