question

Amazon Customer avatar image
Amazon Customer asked

Login : Android login with Amazon

Hello. I have a problem with get authentication code while login time. Can you check with this error why it makes problem? I am using stars.test01@gmail.com private String PRODUCT_ID = "DA_AVS_TEST_ID"; private String PRODUCT_DSN = "1234"; private String CODE_CHALLENGE = "5cd6cb5512be8c93d750b7841b5ae51ef32381c0a34511ce42d442c7c313ee72"; final 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()); mLoginButton = (ImageButton) findViewById(R.id.login_with_amazon); mLoginButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setLoggingInState(true); mAuthManager.authorize(APP_SCOPES, Bundle.EMPTY, new AuthListener()); } }); 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): AuthError during authorization 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): AuthError cat= INTERNAL type=ERROR_SERVER_REPSONSE - com.amazon.identity.auth.device.AuthError: Error=invalid_scope_data error_description=lwa-invalid-parameter-bad-scope-data 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at com.amazon.identity.auth.device.authorization.AuthorizationResponseParser.constructErrorBundle(AuthorizationResponseParser.java:137) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at com.amazon.identity.auth.device.authorization.AuthorizationResponseParser.extractResultsBundle(AuthorizationResponseParser.java:83) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at com.amazon.identity.auth.device.authorization.AuthorizationActivity.onCreate(AuthorizationActivity.java:41) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at android.app.Activity.performCreate(Activity.java:5428) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2281) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2375) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at android.app.ActivityThread.access$900(ActivityThread.java:164) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1268) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at android.os.Handler.dispatchMessage(Handler.java:102) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at android.os.Looper.loop(Looper.java:157) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at android.app.ActivityThread.main(ActivityThread.java:5377) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at java.lang.reflect.Method.invokeNative(Native Method) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at java.lang.reflect.Method.invoke(Method.java:515) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) 09-01 17:52:26.795: E/com.test.amazon.hyunchoh.SampleLoginWithAmazonActivity(15234): at dalvik.system.NativeStart.main(Native Method)
login with amazon
10 |5000

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

leehansub avatar image
leehansub answered
private static final String[] APP_SCOPES = new String[]{ "alexa:all" };
10 |5000

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

luis sergio lugo victorino avatar image
luis sergio lugo victorino answered
Did it works?
10 |5000

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

keven1119 avatar image
keven1119 answered
how can i find my product_id and product_dsn code_challenge.
10 |5000

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

Eric@Amazon avatar image
Eric@Amazon answered
product id is what you initially entered as "device id" on the developer portal. You can find it again by going to the developer portal and looking at the table on the home page of 'Alexa.' The id that you should enter corresponds to the "ID" field of the table. product dsn is the serial number of the device that you specify. It can be whatever you want. If you're authenticating via the web service though, the dsn will need to match the list that you specify in the config. It's important that every unique device be given its own unique serial number code challenge only applies when authenticating a separate device. See https://forums.developer.amazon.com/forums/thread.jspa?threadID=9532&tstart=0 for code samples. See the following thread for a more detailed overview of the different authentication methods. https://forums.developer.amazon.com/forums/thread.jspa?messageID=27529
10 |5000

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