Our website will be down for scheduled maintenance on Thursday, September 18, at 11 p.m. Pacific Time and should be back up by Midnight. We apologize for any inconvenience.

Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Letting users log in through Facebook, Twitter, and other services

From: Drupal 7 Advanced Training

Video: Letting users log in through Facebook, Twitter, and other services

In the last video I showed you how to use Drupal's built-in OpenID system, to allow folks to log in automatically, if they're already logged into an OpenID provider site, such as LiveJournal or Google. In this one, I'll show you a system that's much more complete allowing them to log in with their Facebook and Twitter accounts as well, but along with that completeness comes quite a bit of complexity, and it requires that you join a commercial site named Janrain. But let's get going. The module we will be using is called Janrain Engage, there used to be two competing modules and unfortunately the one that failed is at drupal.org/project/janrain.

Letting users log in through Facebook, Twitter, and other services

In the last video I showed you how to use Drupal's built-in OpenID system, to allow folks to log in automatically, if they're already logged into an OpenID provider site, such as LiveJournal or Google. In this one, I'll show you a system that's much more complete allowing them to log in with their Facebook and Twitter accounts as well, but along with that completeness comes quite a bit of complexity, and it requires that you join a commercial site named Janrain. But let's get going. The module we will be using is called Janrain Engage, there used to be two competing modules and unfortunately the one that failed is at drupal.org/project/janrain.

The good news is that there is a link to the new one, just click on Janrain Engage (formerly RPX) or you can go there directly at drupal.org/project/rpx. If we scroll down, we see a list of supported networks. It's quite a long list and one of them is OpenID. so you could use this as a replacement for Drupal's core OpenID mModule if you wanted to go that way. But also included are Facebook and Twitter, which as I record this are the big ones in the game. As we scroll down further, you'll see that there is a Quick Installation Guide, I'm actually going to walk you through these steps, but of course, this is a good place to check if you have any problems.

Finally, we come to this Dependencies section; it mentions that you have to have a certain extension enabled on PHP. Now this is well beyond the scope of this course, and chances are it'll be turned on your web host. But if you have any problems, this may be the issue, and you'll have to talk with your web host about it. But let's get started. We will go and we will download and install the module. Click Modules, and Install new module. Then Install and enable as usual.

The modules that you want will be in this group Janrain Engage. One of them Janrain Engage Rules Integration isn't available because we haven't yet installed rules. You will find out more about Rules in another section of this course. The point of that module is fairly interesting though, it allows you to have certain actions take place when someone logs in using Janrain. So if someone comes over from Facebook, you could give them a certain page to look at, instead of someone who logs in naturally through your site. Anyway, I am just going to turn this all on and then save.

Now let's configure it, one way to get to the Configuration page is to scroll down to the Modules, then click Configure next to Jarain Engage UI. You can also get there by clicking Configuration and Janrain Engage. This is where you're going to have to sign up with a commercial service, to get this API key I am going to open up a new window here and get Janrain Engage by Command+Clicking. Then on that site I see all of this detail, but what I really want is to sign in. I click Sign In, and interestingly Janrain uses its own system to set up an account, so I will sign in using my Twitter account.

Now what you see here is very similar to what you'll see on our own site. I'll log in and sign in. You may have noticed as we went along, we were given little bit of information about the kind of information that Twitter will hand off to the Janrain site, that's very important and I recommend that you read it as you go. You should be aware of such policy issues as your users will be as well. Now, I've already signed up for this site, so I will be able to just go ahead and get my API Key right away. Go up to Deployment and Application Settings.

And there is our API Key. Before leaving this page I want to add our site to the Domain Whitelist; otherwise, this simply won't work. We have to specifically say we're going to let people log in from Janrain; its a little bit of extra security. So once again that was lynda.tomgeller.com and save. Now we can copy that API Key, go back to our site and paste it in, and then go down and save. I have set up my site in another browser where I'm not logged in and you see over here, if we reload the page, we don't see any kind of special login yet -- that's because we haven't quite completed the process.

I will back to my administration browser, and then I will configure Janrain to accept that by clicking the Authentication tab right here, and this is what we want: Enable Janrain Engage sign-in or login forms. We have several options, but I will just say save. We went through a lot of this to make this work. We are going to switch our hats now; stop thinking like an administrator and changeover and pretend that you are user. I will reload this page, and we now have this new option down here; however, it doesn't actually show Twitter yet, because we have to add Twitter to the list of things we can log in with.

So we go back to the administrator and click on Identity Providers. We can add it by clicking up here, which says Configure and add identity providers. Now this gets a little bit complicated, so I will go through it quickly, and of course, if you need any help, look at the Janrain Engage site. Scroll down and click Providers. And we want to add Twitter, so we click the gear and Janrain will step us through it. Okay, we need a Twitter account; we already have that, so we click Next. Then within Twitter, we click on Create a new application, and use those values.

So let me go back and take a look what that URL is, I will Command+Click it and sign in. As you can see, I have already created one test application. Now I will create one specifically for this site. Create a new application, and copy over that information. Here's the web site, and here's a Callback URL.

The other information is for our own interest, so I will say this is the lynda.tomgeller.com site and To Log In, I will say simply. And of course, we have to agree to their Terms of Service, fill out the CAPCHTA, and click Create. Of course, if you get any sort of errors, just correct them. And let's try again.

Now that we've completed the Twitter site of it, we go back to the Janrain side and see what it tells us to do next. Click on the Settings tab and use the value shown here to update the Application Type section. So we need Access Read and Write on the Settings tab. I made that change and update. Go back to Janrain and continue. Finally, we have to give it some of the secrets information so that it can pass the stuff back and forth between Janrain, Twitter, and our site.

We go up here and click on Details, scroll down, and we need Consumer key and Consumer secret. I will simply copy and paste those and save. And we are done. So you finished with the Twitter side of things. Now go back to Janrain Engage and take another look at that list of providers. You will notice that instead of having a gray gear, Twitter now has a green gear. If you were to click it, you could go back and change all of those settings you just did, but instead we will just take it and drag it into this group here.

And now are ready, go down and save. The last thing that we have to do is go back to our lynda.tomgeller.com site, and save that screen. Go down here and Save configuration. Now when the screen reloads, we click Identity Providers, and along with the ones we saw earlier, we see Twitter. Now when we go back to the user who is not logged in, when we reload this page, the additional icon will show up here. Let's take a look. We reload and there it is.

In order to log in with Twitter, we simply click here. Janrain delivers this Twitter login screen and we click Sign In. We are then asked, of course, to authenticate, and as I mentioned before it shows exactly what lynda.tomgeller.com is able to get from the Twitter site. I will log in, and there we go! As with OpenID, we have logged in using our Twitter account, but for the first time we still have to register on lynda.tomgeller.com. After that's done, the link is complete and it's a lot easier from then on.

Now I have to mention, we've only touched the tip of the iceberg here. If we go back to our Janrain Engage screen on the administrative browser and then take a look at Field Mapping, you will see that you're actually able to take information from people's Twitter accounts and put it into fields in your own site; that is, the fields that Twitter delivers over to you. The same is true for Facebook and all the other ones. And this isn't the only solution for unified logins, although it is the most complete one that I've found so far. To see some of the others, go to drupal.org/ projects/modules, filter by Drupal 7, of course.

And then select the category, User Access &Authentication and click Search. Now I have to say that this is an area that still feels like it's in its infancy. I think it's hampered not by technology, but by cultural and corporate interests. Basically, everybody wants the power that comes with being the gatekeeper. If this is an area that interests you, watch the technology trade press; their frequent changes and maneuverings. And that's one reason that I like Janrain Engage. It's their job to stay on top of such matters; leaving you free to deal with your own site.

Show transcript

This video is part of

Image for Drupal 7 Advanced Training
Drupal 7 Advanced Training

72 video lessons · 10904 viewers

Tom Geller
Author

 
Expand all | Collapse all
  1. 4m 51s
    1. Welcome
      1m 7s
    2. Planning your Drupal career
      3m 44s
  2. 25m 46s
    1. Comparing development and production environments
      6m 22s
    2. Configuring your settings.php file
      7m 10s
    3. Running multiple sites from one Drupal installation
      7m 32s
    4. Troubleshooting common issues
      4m 42s
  3. 51m 20s
    1. Understanding your Drupal site's place on the web
      2m 44s
    2. Selecting a web host
      7m 20s
    3. Using Unix's command-line interface
      8m 23s
    4. Working with your web host's access restrictions
      4m 51s
    5. Using cPanel and other graphical web host interfaces
      3m 40s
    6. Transferring files to and from your web host
      5m 49s
    7. Moving databases using phpMyAdmin
      6m 34s
    8. Moving databases using Unix commands
      6m 8s
    9. Modifying server configuration files
      5m 51s
  4. 27m 10s
    1. Learning from case studies
      3m 13s
    2. Planning your site
      4m 18s
    3. Populating your site with Devel Generate
      3m 42s
    4. Managing URL paths
      3m 20s
    5. Restricting access to downloadable files
      5m 55s
    6. Reusing site components with the Features module
      6m 42s
  5. 21m 53s
    1. Understanding and installing Drush
      5m 23s
    2. Installing Drupal using Drush
      7m 24s
    3. Building a site using Drush
      9m 6s
  6. 31m 59s
    1. Backing up with the Backup and Migrate module
      8m 17s
    2. Moderating comment spam
      6m 47s
    3. Migrating from Drupal 6
      4m 28s
    4. Migrating to Drupal 7
      12m 27s
  7. 22m 24s
    1. Letting users log in through OpenID
      5m 10s
    2. Letting users log in through Facebook, Twitter, and other services
      9m 43s
    3. Republishing posts on Facebook and Twitter
      7m 31s
  8. 1h 5m
    1. Understanding Drupal's base themes
      5m 55s
    2. Introducing base themes: Zen and subtheming
      11m 35s
    3. Introducing base themes: Fusion and extensibility
      10m 44s
    4. Introducing base themes: AdaptiveTheme and responsive design
      7m 25s
    5. Introducing base themes: Omega and mobile devices
      7m 9s
    6. Using Firebug and other theming tools
      7m 20s
    7. Modifying themes with Sweaver
      6m 59s
    8. Modifying themes with Livethemer
      8m 45s
  9. 49m 35s
    1. Understanding the Rules module
      6m 48s
    2. Demonstrating how Rules works in Drupal Commerce
      3m 53s
    3. Creating practical rules
      6m 37s
    4. Improving rules
      9m 10s
    5. Defining conditions with the Context module
      7m 51s
    6. Varying layout with the Context and Delta modules
      5m 0s
    7. Varying layout with the Panels module
      10m 16s
  10. 52m 46s
    1. Enabling social features
      9m 46s
    2. Implementing a voting system
      9m 15s
    3. Rewarding good behavior with the Userpoints module
      5m 57s
    4. Setting up Organic Groups
      6m 28s
    5. Adding content to groups
      2m 21s
    6. Seeing group activity better with views and panels
      10m 13s
    7. Making groups private
      4m 54s
    8. Letting each group have its own permissions
      3m 52s
  11. 25m 32s
    1. Understanding packaged Drupal distributions
      2m 8s
    2. Getting a head start with Acquia Drupal
      7m 28s
    3. Creating online storefronts with Drupal Commerce
      6m 53s
    4. Creating government web sites with OpenPublic
      9m 3s
  12. 1h 30m
    1. Taking the assignment
      3m 26s
    2. Planning the project
      3m 43s
    3. Preparing the infrastructure
      8m 42s
    4. Starting the design
      7m 35s
    5. Filling in the content
      7m 29s
    6. Developing the layout
      10m 27s
    7. Finishing the layout
      7m 8s
    8. Refining the CSS
      6m 32s
    9. Setting up sections for regional offices
      4m 53s
    10. Configuring regional offices
      7m 18s
    11. Connecting to social media
      5m 9s
    12. Cleaning up
      12m 32s
    13. Securing the site
      5m 56s
  13. 37s
    1. Next steps
      37s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Drupal 7 Advanced Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.