Developer Console

Troubleshooting the Login with Amazon WordPress plugin

Greg Bulmash Oct 28, 2016
Share:
How to
Blog_Header_Post_Img

The last Login with Amazon blog post described how to set up the Login with Amazon plugin for Wordpress. In this post we are going to look at the steps you can take if you receive the following error message when trying to log in:
 



In this case, the login process at Amazon seems to work, but when the pop-up window closes, you get the error message. Even more perplexing, you will have what appears to be a valid access token in the URL:

code snippet

When you have this specific issue, the likely reason is that you don't have curl set up properly.

What's curl?
In short, it's a library for making http calls and can be very helpful in making calls to REST APIs. You can install it as a standalone executable that helps you make those API calls from the command line in Windows, Mac, or Linux. You can also install it as an extension for PHP to help make those calls from within a PHP application like WordPress.

In many web server environments, it is installed as part of the default set-up. But in some it isn't. For example, if you're using Cloud9 as a development environment, they have two different workspace templates that support PHP, but only one has curl set up.

In this case, the URL shows the user successfully logged in with Amazon and was passed back to you with a token, but because curl had trouble connecting to Amazon's Profile API, it couldn't get the user's name and email address to create the account.

There are two steps to diagnose the issue. You'll need command line access to your web server and the permissions needed to change configuration files.

Step 1: Is curl enabled?
This is simply ensuring that the curl extension for PHP is available. At a command prompt on your server type php –i. The output will give you a wide variety of information about what capabilities your PHP installation has.

code snippet

f you have curl enabled, you'll see a section that starts with lines like the ones above. If you don't, you'll need to install and/or enable curl. If the official PHP instructions for that feel opaque or confusing, do a search for installing curl for PHP on your specific operating system.

Step 2: Does curl have the root certificate bundle?
When browsers contact secure websites with https connections, they use one of a variety of root certificates to authenticate the security certificate the site is presenting. There's a standard "bundle" of root certificates that is built into most web browsers. For curl to negotiate a secure connection, it needs that bundle.

The folks who make curl also periodically extract the latest version of the bundle from Mozilla and make it available as a file named cacert.pem. Download cacert.pem from them and copy the path to its location.

One of the early lines of the many output by the php –i command will tell you where you have your PHP configuration file (usually php.ini) stored.

code snippet

Open that configuration file and add this line.

code snippet

Save the configuration file and restart your web server.

If you've enabled curl properly, you should now be able to use the plugin to log into your Wordpress installation.

Thanks for reading. If you have any questions or comments, please share them with the LwA team in the LwA forum.

Related articles