code: function (scopes, tokenUrl, OAuthSchemeKey) {
          var params = {
              'client_id': clientId,
              'client_secret': clientSecret,
              'scope': scopes.join(' '),
              'grant_type': 'client_credentials'
          };
          $.ajax({
              url : tokenUrl,
              type: 'POST',
              data: params,
              success: function (data)
              {
                  onOAuthComplete(data, OAuthSchemeKey);
              },
              error: function ()
              {
                  onOAuthComplete('');
              }
          });
      }
docs: taken from lib/swagger-oauth.js