Connecting Drupal with Janrain Engage: Power, Flexibility and Simplicity! April 29, 2011 by Katie Keenan CMS, integration, social login, social sharing This is a guest post by Drupal expert, Ben Kaplan. Ben developed the Drupal 7 Janrain Engage Module. My path to becoming a Drupal developer was born out of necessity. In my “day job,” I was a best-selling author and newspaper columnist. But at night, I was a tech-savvy entrepreneur. And I wanted to engage my readers with an interactive, community-driven website. I started out by hiring a development firm to build a custom content management system for me. When their work failed to impress, I briefly considered rolling my own code. Then it hit me: Why spend time reinventing a wheel that countless others had created before me? That’s when I found Drupal. As an open source platform, Drupal represented a powerful, flexible, and scalable system that could support virtually any type of web application and service I could dream up. With Drupal, instead of worrying about how to manage users, store data, or implement access permissions, I could leverage an ecosystem of well-tested core code and thousands of contributed modules. As I became immersed in Drupal and its developer community over the last five years, a new question arose: How could I better connect my Drupal websites to the popular social networks and web services that my users were also frequenting? Once again, I considered rolling my own code: Using existing Drupal modules as a starting point, I figured I could integrate with Facebook, Twitter, Google, LinkedIn, MySpace, and a few others. But even if I took the time to learn all these different APIs, did I really want to manage and maintain them over time? And as my audience became increasingly global, how would I integrate with other social networks that were popular abroad? When I discovered Janrain Engage, it seemed like the ideal solution. Instead of having to worry about the minutia of each third party service–including how to authenticate users, map user profile data, and share content–I could let the folks at Janrain handle this. Janrain already had an impressive list of social networks onboard and they had a roadmap to add new ones, too. Better yet, by combining Janrain Engage with Drupal, I had the best of both worlds: A powerful, flexible, and simple system to build advanced websites and quickly connect them to the greater social web. After becoming a co-maintainer of Drupal’s Janrain Engage module, I worked hard to expand the module’s feature set so that other Drupal site builders could create advanced authentication and social sharing workflows with no code and just a few clicks. Here are some of the notable features: Login and Registration Allow site visitors to quickly register and login with one of their existing accounts at popular third-party websites such as Facebook, Twitter, Google, and Yahoo!. Support is included by default for both the Drupal user login page and the Drupal user login block (which appears in a sidebar column on any page). Data Mapping With permission of the user, you can map user profile data supplied by Janrain Engage to specific Drupal data fields. Did a user update their real first and last name on Facebook, but didn’t bother to do it on your site? With just a few clicks to configure the data mapping, you can import this data automatically! But what if a user has authenticated with multiple identity providers, including Facebook, Twitter, and LinkedIn? How can you specify which provider profile data gets kept and which data gets overwritten? With our Drupal module, you can simply rank the providers for each field you’re mapping. Linked Account Management A “Linked accounts” tab is provided to any end user who is granted the appropriate permission. Using this tab, a user can easily add, remove, or otherwise manage the third-party identity providers connected to his or her Drupal website account. Social Sharing Make it easy for users to share their Drupal site contributions and activity with friends and followers on other social networks. A “Share” button or link may be included alongside specific Drupal content types (which triggers the Janrain Engage social sharing widget). Better yet, specific “tokens” can be used to completely customize the default text and links included when users share content (similar to “mail merge” fields). Event Triggers and Actions For those also using Drupal’s popular “Rules” module, it’s possible to create sophisticated logic that triggers certain website actions when a user registers or shares content via Janrain Engage. For instance, let’s say that anytime someone registers with a Facebook account you want to send them a special e-mail message that suggests they invite their friends to join the site? Just pick an event (“Linked account was added”), define a condition (“user has linked a Facebook account”), and implement an action (“send an e-mail”). A couple of minutes later, you’re good to go! Custom Data Views What if you want to quickly create an administrative page that shows all of the users on your site who have authenticated using Janrain Engage? Using Drupal’s popular “Views” module and a couple of point-and-click configurations, you can create a custom page that shows all linked accounts on your site and even allows you to filter these results by provider (such as Facebook or Twitter). Better yet, all of the features I’ve mentioned don’t require writing a single line of code. In fact, even a Drupal site building novice can quickly configure these advanced features–making it now possible to integrate with the larger social web in 10 minutes or less! It’s been said that “with great power comes great responsibility.” But these days, with the Drupal content management system, the Janrain Engage service, and Drupal’s Janrain Engage module in your web development toolbox, great power comes with even greater simplicity. Ben Kaplan is a Drupal developer and web technology consultant based in Portland, Oregon. Visit his development blog at www.CrimsonPen.com. For more information about the Janrain Engage module for Drupal (including a demo website), visit http://drupal.org/project/rpx.