Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
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.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101414 Viewers
61 Video lessons · 88175 Viewers
71 Video lessons · 72028 Viewers
56 Video lessons · 103820 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.
Your file was successfully uploaded.