Alexa技能授权失效

huangapple go评论98阅读模式
英文:

Alexa Out-of-Skill Authorization

问题

我正在尝试访问Alexa技能列表,根据https://developer.amazon.com/en-US/docs/alexa/custom-skills/get-a-user-specific-access-token.html#endpoint-without-account-linking,应该可以通过发送请求来实现。但不幸的是,这个文档既没有说明应该发送请求的URL,也没有说明方法(POST?)。
有人能帮助我吗?
我尝试了各种我找到的URL,目前正在使用api.amazon.com/auth/O2/token,但它只返回一个<UnknownOperationException/>。

英文:

I am trying to get access to alexa list skills and according to https://developer.amazon.com/en-US/docs/alexa/custom-skills/get-a-user-specific-access-token.html#endpoint-without-account-linking this should be possible by sending a request. But unfortunately this document neither states the URL the request should be sent to, nor the method (POS?).
Can someone help me out please?
I have tried various URLs I found, currently working with api.amazon.com/auth/O2/token but this just responds with a

&lt;UnknownOperationException/&gt;

答案1

得分: 5

创建技能列表不需要帐户链接。这个文档可以告诉你如何发送请求到列表管理REST API。你也可以发送不需要帐户链接的非会话请求,就像你提到的那样。在这种情况下,你的技能应该收到Alexa.Authorization.Grant,并且授权码应该在请求中。请参考示例。这里

然而,如果你的技能需要监听列表事件,你需要使用帐户链接。

英文:

Creating list skills doesn't require account linking. https://developer.amazon.com/en-US/docs/alexa/smapi/steps-to-create-a-list-skill.html#alexa-lists-access
You can refer this document how to send requests to the List Management REST API. You can also send out-of-session request without Account Linking like you referred. In that case, your skill should receive Alexa.Authorization.Grant and Auth code should be in the request. Please refer the example. https://developer.amazon.com/en-US/docs/alexa/custom-skills/get-a-user-specific-access-token.html#example-without-account-linking

However if your skill needs to listen list events, you need to use account linking.

答案2

得分: 0

根据我的了解,Alexa.Authorization.Grant 请求是OAuth流程的一部分,用于启用支持帐户链接的技能。根据文档所述,这是Alexa将发送给您的技能lambda的内容:

您的技能在技能清单的自定义对象中指定的端点接收授权代码。

这就是为什么文档中没有列出URI,因为您不会发起此请求。

然而,似乎文档有点混淆,对于不需要帐户链接的技能,没有Alexa.Authorization.Grant 请求。取而代之,您可以按照以下步骤操作。

为了获取用于与Alexa进行会话外调用而无需帐户链接的特定用户访问令牌:
  1. 存储所需用户帐户的userId。它可以在LaunchRequestIntentRequest中找到。

  2. 获取访问令牌用于技能消息API。

  3. 使用userId和访问令牌,调用技能消息API向您的技能发送一个虚拟消息。

  4. Alexa将虚拟消息作为Messaging.MessageReceived请求发送到您的技能。从请求中提取consentToken

  5. 使用consentToken调用列表管理API以访问Alexa列表。

参考:使用Python3请求模块访问Alexa购物和待办事项列表

英文:

To my knowledge, the Alexa.Authorization.Grant request is part of the OAuth flow when enabling a skill that supports account linking. It is something Alexa will send to your skill lambda, as stated in the doc:

>Your skill receives authorization codes at the endpoint that you specify in the custom object of the skill manifest.

that's why there's no URI listed in the doc because you don't initiate the request.

However, it seems the doc is mixed up as there's no Alexa.Authorization.Grant request for skills that do not require account linking. Instead, you can follow the steps below.

To get user-specific access token for out-of-session calls to Alexa without account linking:
  1. Store the userId of the desired user account. It can be found in a LaunchRequest or IntentRequest.

  2. Acquire access token for Skill Messaging API.

  3. With the userId and access token, call Skill Messaging API to send a dummy message to your skill.

  4. Alexa will send the dummy message to your skill as a Messaging.MessageReceived request. Extract the consentToken from the request.

  5. Call List Management API with the consentToken to access Alexa list.

Ref: Access the Alexa Shopping and To-Do Lists with Python3 request module

答案3

得分: -2

这实际上是我需要的信息:LWA端点是https://api.amazon.com/auth/o2/token。链接

英文:

This is actually the information I needed: The LWA endpoint is https://api.amazon.com/auth/o2/token.
https://developer.amazon.com/en-US/docs/alexa/smapi/configure-an-application-or-service-to-send-messages-to-your-skill.html#lwa-endpoint

huangapple
  • 本文由 发表于 2023年6月26日 02:00:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76551763.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定