This post is the first in a series about integrating Login with Amazon with popular service providers.
We talked to developers at conferences and hackathons and they told us what they needed: simple integrations. If we made it simple to set up Login with Amazon to work with services they were already using, it made them happy. And happy developers are what we’re all about.
In this blog, we’ll show you how to configure Login with Amazon as a "social connection" with Auth0. Assuming this is a new application, we’ll walk through the basic configuration on Amazon, then the configuration on Auth0.
Configuring your security profile on Amazon
We’ll set up a new Login with Amazon security profile on the Amazon Developer Portal. Log in with your developer account, choose the "Apps & Services" tab, then the "Login with Amazon" option below it. Then you’ll click the button to create a new security profile.
The basic configuration is relatively simple. The name of the profile will be shown to your customers when they’re asked to consent to sharing profile information with you, so make sure you use something that works for public consumption. An image will help the user to associate the consent request with the site/app they’re logging into, so it’s good to use your logo or another representative image.
There are a couple more pieces of information you need to set and grab before you’re done.
Let’s go to your web settings. After you’ve set your basic security profile information, you’ll go back to a list of the security profiles you’ve created. To the right of your new profile is a button with a gear on it. Hover over it and you’ll get a list of options. Choose "Web Settings."
The Web Settings let you set the approved origin and redirect URLs. Because Auth0’s integration uses the Authorization grant, it’s especially important to set the redirect URL properly, because your customers will get an error if there’s a mismatch.
The redirect URL is usually https://yourcustomername.auth0.com/login/callback
I go by the handle YiddishNinja around much of the interwebs, and in the sample below, I’m using the free Auth0 trial account I set up for this.
Next, go to the "General" tab and copy your Client ID code and your Client Secret code.
Now you’re ready to configure Auth0.
Configuring the Login with Amazon social connection on Auth0
Assuming you have an account on Auth0, we’ll go straight to setting up your Social Connection using Amazon. In the sidebar of your dashboard, select "Connections." It will expand to provide some options. Choose "Social." That will bring up a list of "social connections." Turn on Amazon.
Turning that on will trigger a sequence of modal popup windows. The first will ask for you to select one of your Auth0 apps to connect to.
Once you’ve chosen, you’ll go to a popup where you can enter the Client ID and Client Secret you copied from your Amazon security profile.
If you have trouble editing the Client Secret, check the box next to "reveal client secret" to make the field editable. The "Basic Profile" data will give you the customer’s name, email address, and a unique customer ID that will be the same across all of your apps and sites using this security profile. If you need a general location, you can also request the user’s postal code (which would be the zip code for U.S. residents).
When you’re done, save the information, then click the "Try" button.
Assuming you configured correctly, a new window will open with your Login with Amazon page.
See how our image from the security profile configuration up in the upper right? And once you’ve logged in, you’ll be asked by Amazon to consent to sharing your profile information.
I use a different address than my work address for purchases on Amazon. And because I’ve never made a purchase with it or provided billing information, there’s no postal code. When you plan to use Amazon profile data, expect that some people won’t have postal code data.
Consent and you’ll go to an Auth0 success page showing the data it’s going to store for that customer.
Your integration of Login with Amazon with Auth0 is ready to be used in your Auth0-powered projects.
We’ve got more integrations coming. If you’d like to nominate an integration for us to profile in a blog post, tweet it to us at @LoginWithAmazon, or post a note in the developer forums.
Source: Alexa