This simple app builds a basic PHP app running on Heroku and uses Salesforce Identity and the Login Widget project. Users have to log in to get access to data sheet.
You'll need an org that has a Community setup and active. Ideally you should have following the Salesforce External Identity Implementation Guide to set up this org or you have completed the Identity for Customers Trailhead module.
- Deploy this package to your org. The package is an Apex classes needed by the Login Widget
- Go to the force.com site that underlies your Community.
- Click on public access settings and add 'SalesforceLoginWidgetXAuthServer' as an allowed Apex Class. Read this for more information on how to do this
- Make the 'loginservice' and 'loginpage' VisualForce Pages publically accessible as well.
- Deploy this app to Heroku
- Create a Connected App
- Enable OAuth
- Select openid scope
- Set Callback to https://HEROKUAPP_URL/_callback.php e.g. https://strong-castle-20163.herokuapp.com/_callback.php
- Save
- Copy the Consumer Key
- Set the Heroku config vars via Setting > Reveal Config Vars:
- "SALESFORCE_CLIENT_ID" to your Connected App's Consumer key
- "SALESFORCE_COMMUNITY_URL" to the Community's domain, no trailing slash, and no https:// For example: mycommunity.force.com/community2
- "SALESFORCE_HEROKUAPP_URL" to the Heroku app's domain, no trailing slash, and no https:// For example: strong-castle-20163.herokuapp.com
- If you installed the package in a Salesforce Org with a namespace set, you must set the "SALESFORCE_NAMESPACE" config variable
- Open the app and enjoy!