Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit e7770ce607c271e46be90de6fef8606a2bb7f892 @kevinohara80 committed May 3, 2012
Showing with 550 additions and 0 deletions.
  1. +15 −0 .gitignore
  2. +23 −0 LICENSE
  3. +84 −0 README.md
  4. +402 −0 index.js
  5. +26 −0 package.json
@@ -0,0 +1,15 @@
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
+*.gz
+
+pids
+logs
+results
+
+node_modules
+npm-debug.log
23 LICENSE
@@ -0,0 +1,23 @@
+Copyright (c) 2012 Kevin M. O'Hara
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall
+be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,84 @@
+nforce
+======
+
+**nforce** is node.js a REST API wrapper for force.com, database.com, and salesforce.com.
+
+## Features
+
+* Simple api
+* Connection object to manage multiple force.com connections in a single app
+* Helper oauth methods
+
+## Installation
+
+```bash
+$ npm install nforce
+```
+
+## Usage
+
+Require **nforce** in your app and create a connection to an org.
+
+```js
+var nforce = require('nforce');
+
+var org = nforce.createConnection({
+ clientId: 'SOME_OAUTH_CLIENT_ID',
+ clientSecret: 'SOME_OAUTH_CLIENT_SECRET',
+ redirectUri: 'http://localhost:3000/oauth/_callback'
+});
+```
+
+## Authentication
+
+**nforce** supports two OAuth 2.0 flows, username/password and authorization code.
+
+### Username/Password flow
+
+To request an access token using the username and password flow, use the `authenticate()` method and pass in your username and password in the options
+
+```js
+org.authenticate({ username: 'my_test@gmail.com', password: 'mypassword'}, function(err, resp){
+ if(!err) {
+ console.log('Access Token: ' + resp.access_token);
+ } else {
+ console.log('Error: ' + err.message);
+ }
+});
+```
+
+### Authorization Code Flow
+
+## API
+
+Callbacks will always pass an optional error object, and a response object.
+
+```js
+callback(err, resp);
+```
+
+The following list of methods are available for an **nforce** connection object
+
+### getAuthUri()
+
+This is a helper method to build the authentication uri for a authorization code OAuth 2.0 flow.
+
+### authenticate(opts, callback)
+
+This method requests the OAuth access token and instance information from Salesforce. This method either requires that you pass in the authorization code (authorization code flow) or username and password (username/password flow).
+
+* `code`: An OAuth authorization code
+
+-- OR --
+
+* `username`: Your salesforce/force.com/database.com username
+* `password`: Your salesforce/force.com/database.com password
+
+### getVersions(callback)
+
+Gets the salesforce versions. Note: Does not require authentication
+
+###
+## Todo
+
+* Integrated support for Express w/ automated oauth callback generation
Oops, something went wrong.

0 comments on commit e7770ce

Please sign in to comment.