Git Product home page Git Product logo

heroku-force-workbook-demo's Introduction

THIS NO LONGER WORKS - THE APP NEEDS TO BE UPDATED

A tiny web application that:

  • Performs OAuth with Force.com
  • Allows subsequent calls out to Force.com using the Force.rb library.

Read Integrating Force.com and Heroku Applications to learn more about the app.

Creating a Salesforce key and secret

You need a key/secret in order to integrate with a Salesforce app. Do this by creating a Salesforce Connected App:

  • Log on to salesforce
  • Click on your name -> Setup
  • Under "App Setup" click Create -> Apps
  • Under "Connected Apps" click "New"
    • Give the app a name, API name, and email address.
    • Enable "Enable OAuth Settings"
    • For "Callback URL" provide http://localhost:5000/auth/salesforce/callback
    • Give the app "Full access" scope
    • The "Consumer Key" and "Consumer Secret" values should be placed in the .env file as above.

Deploying to Heroku

  1. Push the button: Deploy

  2. Enter the Salesforce Key and Secret when prompted (see below)

  3. Make a note of the app name - for example, obscure-plains-5853.

  4. Edit the Connected App to update the callback URL to correspond to your app. So for example, if your app name was obscure-plains-5853 then the callback URL should be https://obscure-plains-5853.herokuapp.com/auth/salesforce/callback.

  5. Save the new configuration, wait a minute, then access your Heroku app.

Running locally

Create a .env file. Place you Salesforce key and secret from the Salesforce Connected App in the file, together with a cookie secret, like so:

SECRET=some_random_string
SALESFORCE_KEY=324323242334324342343q234Zw.IS
SALESFORCE_SECRET=524444444444468

Then run bundle to install all gems for this app:

$ bundle

Make sure that your Connected App uses localhost as its callback URL as noted above. Set it to http://localhost:5000/auth/salesforce/callback

Then start the app:

$ foreman start

And navigate to it in your browser:

$ http://localhost:5000/

Deploying to Heroku from the command line

$ heroku create
$ git push heroku master

This will create the Heroku app and deploy your code. The final line of the deploy output will show your app name - for example http://still-cliffs-2432.herokuapp.com deployed to Heroku.

Modify the Salesforce Connected App using this app name in the callback URL, for example https://obscure-plains-5853.herokuapp.com/auth/salesforce/callback. Note that you have to use HTTPS.

Now set the env vars with the key and secret of the Salesforce app:

$ heroku config:set SECRET=some_random_string SALESFORCE_KEY=xxxxxx SALESFORCE_SECRET=yyyyy

Visit the application:

$ heroku open

heroku-force-workbook-demo's People

Contributors

nishantchandra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

heroku-force-workbook-demo's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.