Developer : Example Client

Manage applications

The following code demonstrates how to connect an application with Goodsie using the client-side authorization flow. It is a completely self-contained HTML/JS application. To get it working, register an application on Goodsie and replace YOUR_APP_KEY with your application's actual key. Then load the page in a browser.

Note: Goodsie currently only accepts absolute redirect URLs that use the HTTP protocol for the redirect_uri parameter. If you attempt to load the example client on your local filesystem, most browsers prepend the window location with something like file://, which Goodsie won't accept. If that's the case, you need to configure a web server on your machine to serve the file at an URL similar to:
     <title>Client-Side Authorization Example</title> 
     function displayStoreMetadata(metadata) {
       var name = document.getElementById('name');
       var desc = document.getElementById('description');
       var nameText = document.createTextNode(;
       var descText = 

     var appID = "YOUR_APP_KEY";
     if ("error") != -1) {
         alert("Error! Inspect URL for details.");
     } else if (window.location.hash.length == 0) {
       // Not authorized yet. Get an access token
       var path = '';
       var queryParams = ['client_id=' + appID,
        'redirect_uri=' + window.location,
       var query = queryParams.join('&');
       var url = path + query;
       window.location = url;
     } else {
       // We have an access token. Prepare the API call
       var hash = window.location.hash.substring(1);
       var token = hash.substr(hash.indexOf('access_token='))
       var path = "";
       var queryParams = ['bearer_token='+token, 
       var query = queryParams.join('&');
       var url = path + query;

       // Call the Goodsie API. JSONP callback
       // will display results
       var script = document.createElement('script');
       script.src = url;
   <h1 id="store_name"></h1> 
   <p id="store_description"></p>