用户如何授予我的网站管理他们的 Amazon Alexa 列表的权限

问题描述 投票:0回答:0

我希望我的 Next.js TypeScript 应用程序的用户授予它管理他们的 Alexa 列表的权限(使用

read:alexa:household:list write:alexa:household:list
权限/范围)。

我想我需要在我的网站上创建一个按钮,将用户带到一个亚马逊 URL,允许用户授予我的网站管理他们的 Alexa 列表的权限(然后生成一个代码,它包含在一个 GET 请求中作为重定向发生)。

我认为该按钮将是指向定义如下的 URL 的链接

const url = `${oauth2BaseUrl}?client_id=${encodeURIComponent(clientId)}&redirect_uri=${encodeURIComponent(redirectUrl)}&response_type=code&scope=${scope}`;

根据我的经验,这通常是 Oauth2 的工作方式。

但我发现亚马逊的文档非常无用。

我正在设置我的 API 端点(我将在

redirectUrl
指定)以 按照此处显示的代码示例将亚马逊授权代码交换为亚马逊访问令牌

oauth2BaseUrl 应该是“https://www.amazon.com/ap/oa”(位于 https://developer.amazon.com/docs/login-with-amazon/authorization-code-grant.html

我应该使用哪个客户端 ID?我为我的 Alexa 技能创建的那个?

我也开始设置 Login With Amazon,但我不明白为什么有必要这样做。我不想提供联合登录功能。

附言是否有任何图书馆可以使这一切变得更容易?

amazon-web-services oauth-2.0 oauth alexa alexa-skills-kit
© www.soinside.com 2019 - 2024. All rights reserved.