Use Login with Amazon for Shopper Identity
Important
The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.
To customize the Buy with Prime experience to shoppers on your site, you can enable shoppers to sign in with their Amazon account credentials. To enable sign-in functionality, you can use Login with Amazon (LWA) or Amazon Pay. This section describes how to integrate with LWA, which is based on the OAuth 2.0 authentication framework. For a comparison to Amazon Pay, see Manage Shopper Identity.
Shopper sign-in flow
When you integrate your site with LWA, the shopper clicks a link that initiates the sign-in flow through LWA. During that process, you request access to the shopper's profile data. LWA then redirects the shopper back to your site.
After LWA redirects the shopper back to your site, you use the shopper's profile data when you call the Buy with Prime API. For example, you might use the shopper's profile data to provide a smoother checkout experience by prefilling the shipping address with the shopper's default shipping address and mobile number.
For details about this process from a back-end perspective, see LWA Authentication Flow.
Ways to integrate your site with LWA
You can integrate your site with LWA in the following ways. The methods are ordered from the simplest to most complex integration:
-
Buy with Prime UI Library (Recommended): The Buy with Prime UI library offers a low-code solution that provides sign-in functionality. When you use the UI library, you don't need to build your own UI components that initiate the sign-in flow. Instead, you populate a pre-built delivery card component. The UI library supports both redirection and pop-ups for sign-in. For details, see Integrate with LWA by Using Buy with Prime UI Library.
-
LWA SDK: If you prefer to use your own UI components, you can integrate with an LWA SDK. LWA offers SDKs for JavaScript, iOS, and Android. LWA SDKs focus solely on sign-in functionality and don't include pre-built UI components. However, LWA SDKs make it easier to build well-formed authorization requests compared to directly using URL query parameters, and support both redirection and pop-up for sign-in. Using an LWA SDK requires more effort than using the Buy with Prime UI library, and you must follow the Buy with Prime UI guidelines in your implementation. For details, see Integrate with LWA by Using an LWA SDK.
-
Direct integration: If you prefer to use your own UI components and you don't want to use an LWA SDK, you can integrate directly with the LWA OAuth endpoint. Although direct LWA integration is the most flexible way to integrate with LWA, it has some limitations. Direct LWA integration doesn't include Buy with Prime UI components, so you must create your own components that follow the Buy with Prime UI guidelines. For sign-in, direct LWA integration only supports redirection. If you want to have a pop-up window for sign-in, you must add that support yourself. Further, direct integration requires extra effort to clean up the shopper profile data when the shopper signs out. For details about direct integration with LWA, see Integrate Directly with LWA.
Related topics
Updated 2 days ago