Code Monkey home page Code Monkey logo

omniauth-demo's Introduction

omniauth-demo

Based on the Quinton Wall's tutorial and utilizing Richard Vanhook's omniauth-salesforce, this is an update to this popular example running with Rails 3.1.3 with the following gems; oauth2 (0.5.2), omniauth (1.0.2), omniauth-oauth2 (1.0.0), omniauth-salesforce (1.0.3) and httparty (0.8.1). Thanks to Quinton and Richard for their great work on these projects. Here are some brief instructions on how to use it;

  1. Clone this repo to your development environment.
  2. Create .key and .crt files as per this article.
  3. Create the directory lib/certs and copy the .key and .crt files from the previous step to it.
  4. Configure WEBrick so it supports HTTPS using this article as a guide. Don't forget to modify the generic paths so they point to the .key and .crt files you created above.
  5. Create and then modify config/omniauth.yml as shown below so that it has your Salesforce key and secret, changing the placeholders to your actual key and secret.
  6. Make sure the Salesforce account to which these keys are related has REST enabled!
  7. Start WEBrick with rails server while in the root directory of your project.
  8. Point browser to https://localhost:3000
  9. Click 'auth/salesforce' link
  10. You should be redirected to Salesforce login page, to which you enter your credentials.
  11. Approve access by the application.
  12. When returned to the home page, you should now see the Auth token
  13. Click on the '/accounts' link.
  14. You should see the dump of the Account information.

To see Oauth refresh token in action:

  1. Login to Salesforce ... Navigate to 'Administration Setup > Security Controls > Session Settings
  2. Set session timeout to shortest (15 min.)
  3. Start / restart this demo app ... follow steps 8 - 14 above to get Account data.
  4. Wait longer than session timeout (15 min.).
  5. Refresh account page. You will get renewed display of account data.
  6. Look at server log ... see refresh token flow.

omniauth.yml

# simple omniauth.yml configuration file
key: <key>
secret: <secret>

Any questions comments, please don't hesitate to get in touch. The best way is likely to be Twitter @IntellogInc.

omniauth-demo's People

Contributors

terencecgannon avatar

Stargazers

Graham Torn avatar

Watchers

Graham Torn avatar James Cloos avatar

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.