NOTE: Since the release of Summer 13 by salesforce connected apps can now be put into managed packages. fluxgain Like has been upgraded to use a managed package and as a result of this the connected app url below no longer works. The managed package is publicly available on the appexchange -  https://appexchange.salesforce.com/listingDetail?listingId=a0N30000009xXVfEAM. The article below was written before Summer 13 was available.

The Need for Connected Apps

We've been busy updating our fluxgain Like button for salesforce chatter that allows users to quickly like their intranet web pages in a similar way to the facebook like button. Chatter Free, Contact Manger, Group Edition, and Professional Edition users in addition to the existing Enterprise, Unlimited and Developer Edition users can now access the fluxgain like button.

However there are still cases where some users can't use the button due to the salesforce system administrator enabling IP restrictions or login hours within the salesforce org. So salesforce users would see the message "401 Unauthorized - message from salesforce - ip restricted or invalid login hours" when attempting to use the fluxgain Like button.

Salesforce IP Restriction in fluxgain Like

Salesforce IP Restriction in fluxgain Like

What is required is a way to whitelist the fluxgain Like button app but still enable the system administrator to apply security restrictions on the users, this is where salesforces connected apps functionality can help.

Connected Apps quick overview

The connected app functionality allows external applications to provide configuration information to a salesforce org that explains how the external application intends to access the salesforce org. The system administrator can further configure the connected app to determine how users can access the external application. In our case the external application is the fluxgain Like button.

The way the external application provides the configuration information is through a web link that the system administrator must click on to 'install' the connected app configuration into thier salesforce org. This method is very similar to the way a system administrator installs a package into their salesforce org. Details on how to create a connected app for an external application can be found on a developerforce article about Connected Apps.

For the rest of this article we will cover how the connected app is installed and configured for the fluxgain Like button by a salesforce system administrator but before we do this lets check to see if a connected app is needed to use the fluxgain Like button.

Does my salesforce org need the Connected Apps set up for fluxgain Like

Lets test the fluxgain Like button by clicking on the orange like button in the share section on right of this page. If you already have an active salesforce session running in this browser you will not be prompted for your salesforce credentials, if not go ahead and provide your salesforce credentials.

The next step will determine if you need your system administrator to whitelist the fluxgain Like button using Connected Apps. If a message regarding "ip restricted or invalid login hours" appears on the screen then Connected Apps needs to be configured for the fluxgain Like button. If no error message appears about salesforce IP restrictions or login hours you will be presented with the fluxgain like page and will be free to go ahead and use the rest of the application.

fluxgain Like Page

fluxgain Like button page

There might be other reasons why the system administrator might want to install a Connected App such as allowing only certain users the access the app. Lets assume we want to install the connected app  into your salesforce org.

Installing Connected App configuration for fluxgain Like

Only salesforce system administrators can install and configure a Connected App. So these next steps can only be performed by the system administrator

  1.  Click on the connected app link for the fluxgain Like application which is https://login.salesforce.com/services/forceconnectedapps/fluxgain_Like/fluxgain_Like if not already logged into salesforce within the current browser provide salesforce login credentials. ( if your salesforce org is setup to use a custom my domains the connected app link will be https://<xxx>/services/forceconnectedapps/fluxgain_Like/fluxgain_Like where <xxx> is your custom my domain name )
  2. Review the information on the web page before clicking on the install button )
  3. Once installed the fluxgain Like button Connected App web page is presented where further configuration on the Connected App can be done. This page can also be navigated to in salesforce by clicking Setup -> Administration Setup -> Manage Apps -> Connected Apps -> fluxgain Like. Click on Edit to make changes.
  4. To have most flexibility with the Connected App, leave "Permitted Users" as "All Users", change "IP Restrictions" to "Relax IP restriction" and leave "Require Users to Log in" as "The first time they use this application", then click the save button.
Installing fluxgain Like Connected App

Installing fluxgain Like Connected App

Now after 2 minutes of configuration work all salesforce users in the org can now use the fluxgain Like button application. Within the Connected Apps configuration web page a system administrator can optionally determine which user profiles can or can't access the Connected App as well as enforce different IP restrictions. For our purposes we have kept it as simple as possible.

A connected app can only be installed into Group, Professional, Enterprise, Unlimited and Developer Editions only. The fluxgain Like button application will still work with a Contact Manager org provided no IP restrictions have been set up within the org.

Accessing the fluxgain Like button

Lets test the fluxgain Like button again by clicking on the orange like button in the share section on right of this page. If this is the first time a user has accessed the like button they will be asked to grant permission to use the fluxgain Like button. After clicking on the "Allow" button you will be presented with the like button page and will be free to go ahead and use the rest of the application.

User granting access to fluxgain Like

User granting access to fluxgain Like

Wrap up

That's it, after a small amount of configuration the connected app has been enabled for a salesforce org. If you would like to go further and install the like button on your intranet or internal web application please look at

 

 

About Mark Sivill

Mark Sivill has written 14 blogs on fluxgain.

Looking for interesting projects to undertake within IT. Currently focused around cloud technologies such as salesforce and Heroku.