Keeping track of hundreds of different passwords for hundreds of different websites is not only a pain, but it leads to poor security practices. Protocols such as OAuth and OpenID have provided single sign-on support, which eventually expanded to use social media platforms such as LinkedIn, Twitter, and Facebook. Once you have single sign-on support across multiple websites and services, you have the added benefit of tracking users across platforms.

Janrain offers a single sign-on solution complete with customer identity and access-management tools. They offer a range of products, but in this tutorial we will show you how to deploy WordPress with the Janrain Engage plugin on CenturyLink Cloud services. This provides you with a solid base on which to build a cross-platform social media customer identity solution.

Before We Start

If you don’t have a CenturyLink Cloud account yet, head over to our website and sign up for a free trial. You’ll need it to use CenturyLink Cloud tools.

You will also need a Janrain account. Visit the Janrain sign-in page to create one.

Tools Used

CenturyLink Cloud Compute servers are high-performance cloud servers. These enterprise-grade virtual machines are easy to deploy and manage from the CenturyLink Cloud Console and via our powerful API.

CenturyLink Cloud MySQL is a cloud-hosted managed relational database solution. It is backed by 100% flash storage, and automatically scales to handle even the most demanding workloads.

Deploy a New Virtual Server

Our first step is to deploy a new CenturyLink Cloud virtual server. Follow the steps below.

  1. Log-in to the CenturyLink Cloud control portal at https://control.ctl.io/
  2. On the left side menu, click Infrastructure and then Servers.

    janrain

  3. On the left-hand side of the server panel, click on the region for the server we will provision.

  4. Click create and then server.
  5. Fill out the form for your new server.
  6. For operating system, select "Ubuntu 16 | 64-bit".
  7. Click create server.
  8. Your server provisioning request will enter the queue. You can watch the progress of your request on the screen. Your server is provisioned when the status of all tasks in the queue is complete.

    janrain

  9. After your new server is provisioned, in the CenturyLink control portal, click Infrastructure on the left side menu, then click Servers.

  10. Navigate to your new server and click on its name.
  11. Click the more menu, and then click add public ip.
  12. Check the boxes for HTTP (80) and SSH/SFTP (22).
  13. Click add public ip address.

Provision a CenturyLink MySQL Database

Next, we will provision a new CenturyLink Cloud MySQL database. Follow the steps below.

  1. Log-in to the CenturyLink Cloud control portal at https://control.ctl.io/
  2. On the left side menu, click Services and then Relational DB.
  3. On the "Database Instances" page, click + database.
  4. In the "Create Database" form, select "MySQL" for the engine.

    janrain

  5. For "location", pick a data center close to the one you selected for your virtual server.

  6. For "database name", pick a name that makes sense, such as "wordpress". Save this name for later.
  7. Enter a new username and password into the "username" and "password" fields. Save these for later.
  8. You can change the rest of the parameters if your requirements call for them, but the defaults work just fine for this tutorial.
  9. Click Create Database.
  10. You will be redirected to the status page for your new database.
  11. Look for the "CONNECTION" value. This will contain the hostname and port for your database. Save this for later.

janrain

Installing and Configuring WordPress

This section is based on the WordPress Famous 5-Minute Install, but we will guide you through the configuration options for each step.

Creating a DNS Record for Your Virtual Server

To get Janrain and WordPress configured properly, you will need to create a DNS "A" record so you can refer to your server properly. There are too many ways to handle DNS configuration to cover in this tutorial, so we can't walk you through the whole process. However, you will need your virtual server's public IP address to configure DNS. Follow these steps to find it.

  1. Log into the CenturyLink Cloud control portal at https://control.ctl.io/
  2. On the left side menu, click Infrastructure, and then click Servers.
  3. Navigate to the virtual server you provisioned in the previous step and click on its name.
  4. On the right hand side of the server status page, look for IP ADDRESS(ES). Your server's public IP address will be underlined.

Preparing the Virtual Server and Getting Software

  1. From a shell or terminal on your local machine, connect to your virtual server with the following command. Replace "YOUR.HOST.NAME" with your server's hostname.

    ssh root@YOUR.HOST.NAME
    
  1. Install the required Ubuntu packages with the following commands.

    apt update
    apt-get install lamp-server^ postfix -y
    a2enmod rewrite
    service apache2 restart
    
  2. Download and install the WordPress package.

    wget -O wordpress.tar.gz https://wordpress.org/latest.tar.gz
    cd /var/www/html/
    tar --strip-components=1 -xvzf ~/wordpress.tar.gz
    cp wp-config-sample.php wp-config.php
    rm index.html
    

Configuring the Database

Next, we need to prepare the CenturyLink Cloud MySQL database that we created earlier. For this step, you will need the following configuration values from the "Provision a CenturyLink MySQL Database" section.

  • Hostname and port
  • Username
  • Password
  • Database name

  • From the shell prompt on your virtual server, run ifconfig to get your server's private IP address. In the example below, it is "10.80.109.12", highlighted.

    janrain

  • Run the following command to configure the database. Replace "CONNECTION_HOST", "CONNECTION_PORT", "USERNAME", and "PASSWORD" with the configuration values for your CenturyLink Cloud MySQL database.

    mysql -h CONNECTION_HOST -P CONNECTION_PORT -u USERNAME -pPASSWORD
    
  • At the "mysql>" prompt, run the following commands. Replace "PRIVATE.VPS.IP" with your private IP address. Replace "USERNAME" and "PASSWORD" with the configuration values for your CenturyLink MySQL database. Each command should produce a "Query OK" response.

    CREATE DATABASE wordpress;
    GRANT ALL PRIVILEGES ON wordpress.* TO 'USERNAME'@'PRIVATE.VPS.IP' IDENTIFIED BY 'PASSWORD';
    FLUSH PRIVILEGES;
    EXIT
    

Setting Up wp-config.php

Next, we will configure WordPress to connect to the MySQL database we just created. The following commands will be run in the shell on your virtual server.

  1. Run the following command to make sure you're in the correct directory.

    cd /var/www/html/
    
  2. In your favorite text editor, open wp-config.php. Look for the line that says /** MySQL settings - You can get this info from your web host **/ and edit the section under it to look like the following. Replace "CONNECTION_HOST", "CONNECTION_PORT", "USERNAME", and "PASSWORD" with the configuration values for your CenturyLink Cloud MySQL database.

    /** The name of the database for WordPress */
    define('DB_NAME', 'wordpress');
    
    /** MySQL database username */
    define('DB_USER', 'USERNAME');
    
    /** MySQL database password */
    define('DB_PASSWORD', 'PASSWORD');
    
    /** MySQL hostname */
    define('DB_HOST', 'CONNECTION_HOST:CONNECTION_PORT');
    
    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');
    
    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');
    
  3. Run the following commands to make sure permissions are set correctly and the web server is running.

    chown -R www-data.www-data /var/www/html/
    service apache2 restart
    

Finish WordPress Configuration

To finish the configuration of your new WordPress installation, follow these steps.

  1. In your web browser, go to "http://YOUR.HOST.NAME/". Replace "YOUR.HOST.NAME" with the IP address of your virtual server.
  2. Follow the rest of the configuration instructions on the screen.

Create a Janrain Engage Application

Before we add the WordPress plugin, we need to create a new Janrain Engage application to support social login. Follow these steps.

  1. Login to your Janrain dashboard at https://dashboard.janrain.com/
  2. Click + New Property.
  3. Click Create an App next to "Engage".

    janrain

  4. Follow the instructions on the app creation wizard.

  5. When you are returned to your dashboard, click the "Manage Engage app" icon next to your new application.
  6. Take note of the "API Key (Secret)". You will need that value later.
  7. Add the hostname for your CenturyLink Cloud Compute virtual server to the "Domain Whitelist" box and click Save.

Add the Janrain Engage Plugin to WordPress

Finally, we will add the Janrain Engage plugin to your WordPress installation and configure it. Follow the steps below:

  1. Login to your WordPress control panel at http://YOUR.HOST.NAME/wp-admin/ -- replace "YOUR.HOST.NAME" with the hostname for your virtual server.
  2. In the left panel, click Plugins > Add New.
  3. In the search box, enter "RPX".
  4. You will see a list of plugins pop up. Under "Janrain Social Login", click Install Now.
  5. Once the installation is complete, click Activate.
  6. In the left panel, click Janrain Engage.
  7. On the "Janrain Engage Setup", enter your Janrain Engage application API Key into the "Engage API Key" box.
  8. Configure the rest of the plugin options to suit your requirements.
  9. Click Save Changes.

Your WordPress application will now have social login and registration for users. You can see it in action on the admin login form or on blog post comment forms.

janrain

Next Steps

Janrain offers a wide variety of powerful social user management tools. Once you have Janrain Engage working in WordPress, you can explore further integration in other applications. Leveraging the capabilities of the CenturyLink Cloud with social user management brings the full power of distributed cloud-based applications to your project.

We’re a different kind of cloud provider – let us show you why.