Search code examples
amazon-web-serviceswin-universal-applogin-with-amazon

WebAuthenticationBroker in a Universal App with Login With Amazon


I'm working on a new Universal App (first time) and I am trying to use Login with Amazon as my authentication provider. Amazon doesn't provide an SDK for .NET for LWA so I'm left trying to figure it out on my own.

Here is what I am doing so far:

var redirectUrl = "https://localhost/";
var baseUrl = "https://amazon.com/ap/oa?client_id=MY_CLIENT_ID&response_type=code&scope=profile";
var uri = new Uri(baseUrl);
var redirectUri = new Uri(redirectUrl);
WebAuthenticationResult webAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, uri, redirectUri);

This gets me to the login with Amazon page just fine, and allows me to login, but handing off back seems to be a problem.

Any and all help appreciated.


Solution

  • Amazon LWA Developer Guide

    Page 25.

    enter image description here

    As I can see you missed some required parameters - scope and redirest_uri. Specify them properly and probably it will work.

    For a Universal App, make sure you enable the Internet Client & Server Capability.