为 Amazon Alexa Connected Home 技能设置 Oauth 的简单方法是什么?

What's an easy way to setup Oauth for an Amazon Alexa Connected Home skill?

我正在尝试制作 Alexa Connected Home 技能的原型,其中一项要求是使用 Oauth 2.0 链接用户帐户。因为我只是在构建一个原型,我没有启动 Oauth 服务器,所以 运行 满足 Amazon Oauth 要求的最简单方法是什么?

我已尝试按照 Tips for Using Login with Amazon in Alexa Connected Home CoHo Skills 上的说明进行操作,但无论我如何尝试,它都失败了,并显示了一条无意义的错误消息。

tl;博士

使用亚马逊控制台登录:

Allowed Origins: https://amazon.com
Allowed Return URLs: <copied from "Redirect URL" in the Alexa Developer Console>

Alexa 开发者控制台:

Authorization URL: https://www.amazon.com/ap/oa
Access Token URI: https://api.amazon.com/auth/o2/token
Scope: profile:user_id
Client Id: <copied from "Client Id" in the Login With Amazon Console. eg. amzn1.application-oa2-client.xxxxxxxxxxx >
Client Secret: <copied from "Client Secret" in the Login With Amazon Console.>

我能够使用 Login with Amazon 作为 Oauth 提供商。我按照 Login with Amazon Web Developer Guide 中的文档进行操作,找到了我丢失的配置。

为了使 Login With Amazon 正常工作,我执行了以下操作:

  • 打开 Amazon Alexa 开发人员控制台并转到您的技能的配置选项卡(包含有关帐户链接信息的页面。

  • 设置权限URLhttps://www.amazon.com/ap/oa

  • 范围设置为profile:user_id

  • 访问令牌 URI设置为https://api.amazon.com/auth/o2/token

  • 复制此页面中的 Redirect URL 用于 Login with Amazon 配置(例如重定向 URL:https://pitangui.amazon.com/api/skill/link/xxxxxxxxx).

  • 按照 Tips for Using Login with Amazon in Alexa Connected Home CoHo Skills 中的第 1、2 步和第 3 步的大部分步骤进行 "Using Login with Amazon as your OAuth provider"。

Step 1 - Create a New Security profile

To create a new security profile on Login with Amazon, go the Developer Console and navigate to Login with Amazon by clicking on Apps & Services. Once you are on the Login with Amazon developer console page, click the Create a New Security Profile button.

Fill in the required information and hit Save.

Step 2 - Obtain Your OAuth Credentials

Your newly created security profile will now be available in the list of Login with Amazon Configurations.

You will receive the Client ID and Client Secret. Please include this information when you submit your skill adapter for test provisioning.

Click Show.

Step 3 - Whitelist Your Alexa Connected Home Skill

Next, we need to whitelist the Alexa Connected Home skill’s endpoints within your Login with Amazon security profile. First, enter the Web Settings of your security profile:

Next, click Edit on the page, and enter the following data:

  • 这是我停止遵循该博客 post 中的说明的时候。我现在设置 Allowed OriginsAllowed Return URLsAllowed Origins 应该是 https://amazon.comAllowed Return URLs 应该是 Redirect URL 从 Alexa Developer Console 的帐户链接页面复制

  • 从 Login With Amazon Console 复制 Client IdClient Secret 并将它们粘贴到Alexa 开发者控制台的 Client IdClient Secret 字段。