JSFiddle - React, Tailwind, and code Playground

by edskeizer

HTML

<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/hmac-sha1.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/enc-base64-min.js"></script>
<script src="http://sandbox.edskeizer.nl/oauth-1.0a.js"></script>
<div id="output"></div>
<form enctype="multipart/form-data">

<input type="submit" id="submit" value="upload" />
</form>

CoffeeScript

## CODE TO CALL DB WITH OAUTH

#[email protected]
window.oauth_credentials = {
    'consumer_key': 'HKlmA0iC0K0TON0mBtdV62mzpmYk9vWm',
    'consumer_secret': 'CwfHbSjgXMpGHrCW3M4FF8dG6CSJkwzdqEtwZbiVVeBvgPbPAIyXP6bG00kma1hL',
    'token_public': 'ctMY42BLvYtHUqTNWaAn6CYKrdts3FYk',
    'token_secret': 'HmSVGI7clZ6evCvykUBul2bNTi39TTovAzhwu3KKaKKnKhjLqQG3TxvbikICatZC'
}

#[email protected]
window.oauth_credentials = {
    'consumer_key': 'Joa80vfjQlaJ4jrwevPF7azvMZyJDG9g',
    'consumer_secret': '3MqTqfDLlo6YuFgLMX5fLcbrlhIKFZt6hkzwDi9HtP2lNyt8h2N1KmKVvj2GlbM7',
    'token_public': 'OilJwfo3VcC4v7KwLJrduHjpoZcc6Zg7',
    'token_secret': 'skTLjb0k7E8iodkoWR9QkizGD4Y5FXBum1qlVVd4IWsB1XgkEdbhVmiO7uwGswqg'
}


window.oauth = OAuth(
    consumer:
      'public': window.oauth_credentials.consumer_key
      'secret': window.oauth_credentials.consumer_secret
    signature_method: "HMAC-SHA1"
)
  
token =
    'public': window.oauth_credentials.token_public
    'secret': window.oauth_credentials.token_secret

request_data = 
    "url": "https://alpha.api.aware.care/aware_user_yfgeumej763nczkj9rei28bwwk3lgfy9sh6xkx0c/d%40dsx.nl?revs=true&open_revs=[\"540-cc69fba9027e1f238549c5af745373d1\"]&attachments=true", #to check auth state 
    "method": "GET"

options = {}
options.url = request_data.url
options.method = request_data.method
options.cache = true 
options.headers = {}
options.headers["If-Modified-Since"] = "Sat, 1 Jan 2005 00:00:00 GMT"

options.url = options.url.replace(/:\/((?!(\/)))/g, "/");
options.headers = window.oauth.toHeader(window.oauth.authorize(options, token));
    
xhr = undefined
timer = undefined
hasUpload = undefined

abortReq = ->
  xhr.abort()
  return

if options.xhr
  xhr = new (options.xhr)
else
  xhr = new XMLHttpRequest
# cache-buster, specifically designed to work around IE's aggressive caching
# see http://www.dashbay.com/2011/05/internet-explorer-caches-ajax/
if options.method == 'GET' and !options.cache
  hasArgs = options.url.indexOf('?') != -1
 ...