question

ampersand-rew avatar image
ampersand-rew asked

invalid_scope_data during authentication

I'm trying to modify the SampleLoginWithAmazonAppForAndroid project (from: https://images-na.ssl-images-amazon.com/images/G/01/lwa/samples/SampleLoginWithAmazonAppForAndroid-src._TTH_.zip) to generate an authorization code that I can send to my embedded device, but I consistently get the following error message: "Error=invalid_scope_data error_description=lwa-invalid-parameter-bad-scope-data" If I use the mAuthManager.authorize call that comes with the sample project, it works fine. Here's my mAuthManager.authorize call (pulled from this guide: https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/docs/authorizing-your-alexa-enabled-product-from-an-android-or-ios-mobile-app): private static final String PRODUCT_ID = "BLUMOO_V2_D21_EVK"; private static final String PRODUCT_DSN = "123456"; private static final String CODE_CHALLENGE = "OWQpS2ZGE3mNGkd-uK0CEYtI0MVzjEJ2EyAvLtEjtfE"; 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 AuthListener()); According to the debugger, the scope_data string is: {"alexa:all":{"productID":"BLUMOO_V2_D21_EVK", "productInstanceAttributes":{"deviceSerialNumber":"123456"}}} I've registered the product with AVS. Here's a copy&paste from the portal ( https://developer.amazon.com/edw/home.html#/avs/list): Display Name ID Type Category Blumoo V2 BLUMOO_V2_D21_EVK Device Home Automation I've added the API key (this was generated using the debug.3p.keystore that came with the sample project): eyJhbGciOiJSU0EtU0hBMjU2IiwidmVyIjoiMSJ9.eyJ2ZXIiOiIzIiwiZW5kcG9pbnRzIjp7ImF1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EVowm2KE3WCLwiPJC56iRvtLBVxAkr+rS+oBJ/zWnLgBbLkiYBQftmSXnJc2sSroW1sWgXgcNsf3SpVAElm7kg== Package com.amazon.identity.auth.device.lwaapp Signature 68:82:D3:C9:53:4B:65:CC:A1:95:14:2F:2B:75:1D:82 Does anybody have an idea of what I could be missing? If it looks like I'm missing something so stupid that it's not worth pointing out, please point it out anyways. I'm an firmware developer by trade, so this is my first foray into this sort of stuff.
alexa voice service
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

elstryan@Amazon avatar image
elstryan@Amazon answered
Hi ampersnad_rew, One of the reasons for the “invalid_scope_data” error is a mismatch in security profile and the device. Can you please try the following steps and see if it resolves the issue? 1. Please visit https://developer.amazon.com/edw/home.html and login using your developer account user ID and password. 2. Please click on “Get Started” under Alexa Voice Service. You will see your device ( Blumoo V2 BLUMOO_V2_D21_EVK) listed in the table. 3. Please click on “Edit” button for Blumoo V2 BLUMOO_V2_D21_EVK entry. 5. On the left, please click on “Security Profile” and then click on “Android/Kindle Settings” (in the center of the page). Your will see your Android “Key” here.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.