Skip to content

Instantly share code, notes, and snippets.

@mpguerra
mpguerra / ADSpecOAuthClientCredentials.json
Created February 13, 2014 11:14
Example of an Active Docs JSON spec for an OAuth token endpoint for the Client Credentials Flow
{
"basePath": "http://nginx-oauth.herokuapp.com",
"apiVersion": "v1",
"apis": [
{
"path": "/oauth/token",
"operations": [
{
"httpMethod": "POST",
"summary": "Returns the Access Token to call the API",
@mpguerra
mpguerra / ActiveDocsXHRhijack.js
Last active August 29, 2015 13:56
An example of adding an event listener to an existing XMLHttpRequest for 3scale Active Docs in order to automatically populate access tokens for OAuth2 calls
// save the original open
var originalOpen = XMLHttpRequest.prototype.open;
function onLoad(event) {
var jsonResponse = JSON.parse(this.response);
if('access_token' in jsonResponse){
populate_access_tokens(jsonResponse.access_token)
}
}