如何通过Android的Alexa语音服务进行身份验证? [英] How to Authenticate with Alexa Voice Service from Android?

查看:235
本文介绍了如何通过Android的Alexa语音服务进行身份验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试按照此页面上的说明从和Android应用程序连接到Alexa语音服务。 https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/docs/authorizing-your-alexa-enabled-product-from-an-android-or或-ios-mobile-app

I am trying to connect to Alexa Voice Service from and Android app following the directions on this page. https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/docs/authorizing-your-alexa-enabled-product-from-an-android-or-ios-mobile-app

Bundle options = new Bundle();
String scope_data = "{\"alexa:all\":{\"productID\":\"" + PRODUCT_ID +
                    "\", \"productInstanceAttributes\":           {\"deviceSerialNumber\":\"" + PRODUCT_DSN + "\"}}}";
options.putString(AuthzConstants.BUNDLE_KEY.SCOPE_DATA.val, scope_data);
options.putBoolean(AuthzConstants.BUNDLE_KEY.GET_AUTH_CODE.val, true);
options.putString(AuthzConstants.BUNDLE_KEY.CODE_CHALLENGE.val, CODE_CHALLENGE);
options.putString(AuthzConstants.BUNDLE_KEY.CODE_CHALLENGE_METHOD.val, "S256");
mAuthManager.authorize(APP_SCOPES, options, new AuthorizeListener());

首先,我不知道APP_SCOPES应该是什么。我将其设置为:

First, I don't know what APP_SCOPES should be. I set it to:

protected static final String[] APP_SCOPE = new String[]{"profile", "postal_code"};

但是我收到服务器错误

AuthError cat= INTERNAL type=ERROR_SERVER_REPSONSE - com.amazon.identity.auth.device.AuthError: Error=invalid_scope error_description=An unknown scope was requested


推荐答案

APP_SCOPE 是: alexa:all

The APP_SCOPE is : "alexa:all"

PRODUCT_DSN 可以是您想要的任何内容,根据Joshua Frank( https://forums.developer.amazon.com/forums/message.jspa?messageID=18973#18973

The PRODUCT_DSN can be anything you want, "1234" as per suggestion from Joshua Frank (https://forums.developer.amazon.com/forums/message.jspa?messageID=18973#18973)

PRODUCT_ID 是AVS开发人员门户网站( https://developer.amazon.com/edw/home.html#/avs/list

The PRODUCT_ID is the ID in the AVS Developper Portal (https://developer.amazon.com/edw/home.html#/avs/list)

安全性配置文件中的 CODE_CHALLENGE 客户端机密您的应用程序(应该已经在S256中进行了哈希处理)

The CODE_CHALLENGE the Client Secret in the Security Profile of your application (should be already hashed in S256)

这篇关于如何通过Android的Alexa语音服务进行身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆