question

hho-inno avatar image
hho-inno asked ·

invalid_scope when trying to perform new AVS hosted splash scope [Solved]

Hi,

Trying to implement the new requirements from Amazon to pump our users to the new AVS hosted splash scope by adding the new "alexa:voice_service:pre_auth" scope to the "alexa:all" scope for our hybrid Android app.

https://developer.amazon.com/blogs/alexa/post/2abdf658-556c-4700-8cbd-ada7bd18dbf5/introducing-the-avs-hosted-splash-screen

https://developer.amazon.com/docs/alexa-voice-service/authorize-companion-app.html

However we're seeing this exception:

W/ContextImpl( 1165): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1165 android.content.ContextWrapper.sendBroadcast:365 com.android.systemui.statusbar.phone.PhoneStatusBar.updateAppMessage:1658 com.android.systemui.statusbar.phone.PhoneStatusBar.updateAppMessage:1650 com.android.systemui.statusbar.phone.PhoneStatusBar.removeNotification:2300
W/System.err(26498): java.net.MalformedURLException: Unknown protocol: amzn
W/System.err(26498): at java.net.URL.<init>(URL.java:182)
W/System.err(26498): at java.net.URL.<init>(URL.java:125)
W/System.err(26498): at com.android.browser.iI.a(UrlHandler.java:100)
W/System.err(26498): at com.android.browser.bE.a(Controller.java:1666)
W/System.err(26498): at com.android.browser.hP.shouldOverrideUrlLoading(Tab.java:898)
W/System.err(26498): at com.miui.com.android.webview.chromium.WebViewContentsClientAdapter.shouldOverrideUrlLoading(WebViewContentsClientAdapter.java:346)
W/System.err(26498): at com.miui.org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(AwContentsClientBridge.java:261)
W/System.err(26498): at com.miui.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
W/System.err(26498): at com.miui.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:48)
W/System.err(26498): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err(26498): at android.os.Looper.loop(Looper.java:136)
W/System.err(26498): at android.app.ActivityThread.main(ActivityThread.java:5052)
W/System.err(26498): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(26498): at java.lang.reflect.Method.invoke(Method.java:515)
W/System.err(26498): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
W/System.err(26498): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
W/System.err(26498): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
W/System.err(26498): at dalvik.system.NativeStart.main(Native Method)
D/SystemAdController( 1382): Activity:ActivityInfo{42c02a40 com.amazon.identity.auth.device.workflow.WorkflowActivity}is not the default one
D/AdClientRecord( 1382): Splash target was not initialized.
D/SystemAdController( 1382): Package:com.buddytalk.setup01 is not in the list
D/SystemAdController( 1382): requestSplashScreen duration:1
I/ActivityManager( 1089): START u0 {act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=amzn://com.buddytalk.setup01?error_description=An+unknown+scope+was+requested&state=clientId=amzn1.application-oa2-client.2ab09a87dbb94c3ab7dcdfff5267c196&redirectUri=amzn://com.buddytalk.setup01&clientRequestId=6fdf4ed7-7db0-4bfb-b118-7eb8b4febcd9&InteractiveRequestType=com.amazon.identity.auth.device.authorization.request.authorize&com.amazon.identity.auth.device.authorization.return_auth_code=true&error=invalid_scope cmp=com.buddytalk.setup01/com.amazon.identity.auth.device.workflow.WorkflowActivity (has extras)} from pid 26498

...

D/com.amazon.identity.auth.device.api.workflow.RequestContext(26017): RequestContext b6200f14-e91e-4897-b6f8-cf363a546a9e: onResume
D/com.amazon.identity.auth.device.interactive.GenericInteractiveState(26017): InteractiveState 66c534e8-b828-4e88-8649-d5a540f90e4c: Processing request 6fdf4ed7-7db0-4bfb-b118-7eb8b4febcd9
D/com.amazon.identity.auth.device.ResponseManager(26017): Dequeuing pending response for request ID 6fdf4ed7-7db0-4bfb-b118-7eb8b4febcd9
D/com.amazon.identity.auth.device.api.workflow.RequestContext.PII(26017): RequestContext b6200f14-e91e-4897-b6f8-cf363a546a9e: processing response:<obscured>
D/com.amazon.identity.auth.device.RequestManager.PII(26017): Handling response for request 6fdf4ed7-7db0-4bfb-b118-7eb8b4febcd9:<obscured>
D/com.amazon.identity.auth.device.authorization.AuthorizationResponseProcessor.PII(26017): Received response from WebBroswer for OAuth2 flow:<obscured>
D/com.amazon.identity.auth.device.authorization.AuthorizationResponseParser.PII(26017): Received response from OAuth2 flow:<obscured>
D/com.amazon.identity.auth.device.authorization.AuthorizationResponseParser.PII(26017): Code extracted from response:<obscured>
D/AmazonLoginPlugin(26017): There was an error during the attempt to authorize the application
D/AmazonLoginPlugin(26017): ERROR_SERVER_REPSONSE
D/AmazonLoginPlugin(26017): INTERNAL
D/AmazonLoginPlugin(26017): AuthError cat= INTERNAL type=ERROR_SERVER_REPSONSE - com.amazon.identity.auth.device.AuthError: Error=invalid_scope error_description=An unknown scope was requested

Wondering if we're doing something wrong?

Our code is doing this:

public void run() {
AuthorizationManager.authorize(new AuthorizeRequest
.Builder(mRequestContext)
.addScope(alexaScope(mProductID, mProductDSN))
.addScopes(computeScopes(mScopeFlag))
.forGrantType(AuthorizeRequest.GrantType.AUTHORIZATION_CODE)
.withProofKeyParameters(mCodeChallenge, CODE_CHALLENGE_METHOD)
.build());
}

where addScope() adds the "alexa:all" scope with the required product ID and serial number and addScopes() injects all the other additional scopes... in this case the new AVS splash screen one. Does our app need to handle any new browser custom URL schemes?!

Thanks!

PS: LWA works fine and current app is able to register our AVS ready device online. Only this new requirement is failing. Our device has no Alexa app.

alexa voice servicealexacompanion app
10 |2000 characters needed characters left characters exceeded

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

hho-inno avatar image
hho-inno answered ·

Hi,

No still the same kind of error "invalid_scope".

Just wondering if support for this scope has been pushed to production?

Thanks.

6 comments
10 |2000 characters needed characters left characters exceeded

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

Hi,

The scope "alexa:voice_service:pre_auth" is in production. Error "invalid_scope" is misleading, while the root cause is that the security profile for the API_KEY used here is not whitelisted for scope "alexa:voice_service:pre_auth".

To whitelist a security profile not yet associated with an AVS product, you need to Register a Product and Activate Security Profile.

https://developer.amazon.com/docs/alexa-voice-service/register-a-product.html

https://developer.amazon.com/docs/alexa-voice-service/activate-security-profile.html

To whitelist a security profile associated with an existing AVS product, do the following steps:

1. Go to AVS console

2. Choose the product you want to update

3. On "Information" tab

4. Change "Brief product description" to "AVS hosted splash"

5. Hit "Update" button

0 Likes 0 ·

Hi,

Great this worked! Totally missed that in the instructions... was this anywhere? Anyways our Android companion app is getting the splash screen now and no errors. Will go on to validate other platforms and scopes.


Thanks!

1 Like 1 ·

Glad to know the problem solved. :) The solution will be added to authorize-companion-app instructions.

0 Likes 0 ·
Show more comments
Show more comments
Saravana@Amazon avatar image
Saravana@Amazon answered ·

@NewUser-1434cb60-0266-4056-aefc-f18b3e6898f7,

From the error: "An unknown scope was requested", it looks like there is a typo in the scope name you're passing to our authorization system. Can you please double check the scope name (alexa:voice_service:pre_auth) ?

10 |2000 characters needed characters left characters exceeded

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

hho-inno avatar image
hho-inno answered ·

Hi Saravana,

Thanks for the response. Yes I have checked it and copy/paste from the docs. It is "alexa:voice_service:pre_auth". Here's part of the code that implements it:

if ((mScopeFlag & PROFILE_ALEXA_PRE_AUTH) != 0) {
scopes.add(ScopeFactory.scopeNamed("alexa:voice_service:pre_auth"));
Log.i(TAG, "Profile: alexa pre_auth scope added");
}
return scopes.toArray(new Scope[scopes.size()]);

Thanks!

BTW I'm building using Amazon SDK for Android version 3.0.4

10 |2000 characters needed characters left characters exceeded

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

hho-inno avatar image
hho-inno answered ·

Hi,

Here's logs from futher upstream:

D/AmazonLoginPlugin(22300): Authorization was completed successfully
D/com.amazon.identity.auth.device.authorization.ProfileHelper(22300): Updating local profile information
D/SystemWebChromeClient(22300): file:///android_asset/www/build/main.js: Line 3221 : profile auth from LWA is {"accessToken":"Atza|IwEBIEhPDjTAXYcqHwnvQcs95LT5SG7jTXjr13Mb2DM5sBSvGgEPQFmURgERJ4mWSSRKYXI_Hk5w7Ti3gp94xA6SlhnR4ke5K1vZgIi8XBh7o611SMbpI3vyg9vnZmZy-c0LvxGeUgzVcaDPrj5Ydw-ZgCPTy35sf6qOEBpvF9walxIym5mZbE47IY_7JHM5pe1EMJmxG4ffXC3Ld1qetV-ew68rDxeHpi5tePXC9yZEDQLLvVeWQ0p512Uokdw2at-g51CfA5g3NKuig4fRKku9A9cC128020gA9ctZTTZctmChGHUMtS43zSPySadeQFdU1fo0agNZtEnmMc3u_40j2p19Pgz5Y6xiD434zguqGiSol_BOpvyok3DEbp6jjLyyoBxu_DgEXDyzh4g9aY3umhs-Td3BPS6YlEceV0Vdj99GDXEIcmaVJ8qrRHsCbxxoq7-9rjHzemBa3nS_c7gtBlGsII_-XPy_2t8rvjklW5_HcRuJ0vgxqW6oDclRJOSpUIGXhh0n6Iec2HwzCVeyd72779VZgn6lxGfbURr3EHUTzg","user":{"email":"16a208@gmail.com","user_id":"amzn1.account.AFU6JA4BFHQ7MFMNE73JRLO7IGQQ","name":"avs16a208"}}
I/chromium(22300): [INFO:CONSOLE(3221)] "profile auth from LWA is {"accessToken":"Atza|IwEBIEhPDjTAXYcqHwnvQcs95LT5SG7jTXjr13Mb2DM5sBSvGgEPQFmURgERJ4mWSSRKYXI_Hk5w7Ti3gp94xA6SlhnR4ke5K1vZgIi8XBh7o611SMbpI3vyg9vnZmZy-c0LvxGeUgzVcaDPrj5Ydw-ZgCPTy35sf6qOEBpvF9walxIym5mZbE47IY_7JHM5pe1EMJmxG4ffXC3Ld1qetV-ew68rDxeHpi5tePXC9yZEDQLLvVeWQ0p512Uokdw2at-g51CfA5g3NKuig4fRKku9A9cC128020gA9ctZTTZctmChGHUMtS43zSPySadeQFdU1fo0agNZtEnmMc3u_40j2p19Pgz5Y6xiD434zguqGiSol_BOpvyok3DEbp6jjLyyoBxu_DgEXDyzh4g9aY3umhs-Td3BPS6YlEceV0Vdj99GDXEIcmaVJ8qrRHsCbxxoq7-9rjHzemBa3nS_c7gtBlGsII_-XPy_2t8rvjklW5_HcRuJ0vgxqW6oDclRJOSpUIGXhh0n6Iec2HwzCVeyd72779VZgn6lxGfbURr3EHUTzg","user":{"email":"16a208@gmail.com","user_id":"amzn1.account.AFU6JA4BFHQ7MFMNE73JRLO7IGQQ","name":"avs16a208"}}", source: file:///android_asset/www/build/main.js (3221)
D/SystemWebChromeClient(22300): file:///android_asset/www/build/main.js: Line 3222 : access token: Atza|IwEBIEhPDjTAXYcqHwnvQcs95LT5SG7jTXjr13Mb2DM5sBSvGgEPQFmURgERJ4mWSSRKYXI_Hk5w7Ti3gp94xA6SlhnR4ke5K1vZgIi8XBh7o611SMbpI3vyg9vnZmZy-c0LvxGeUgzVcaDPrj5Ydw-ZgCPTy35sf6qOEBpvF9walxIym5mZbE47IY_7JHM5pe1EMJmxG4ffXC3Ld1qetV-ew68rDxeHpi5tePXC9yZEDQLLvVeWQ0p512Uokdw2at-g51CfA5g3NKuig4fRKku9A9cC128020gA9ctZTTZctmChGHUMtS43zSPySadeQFdU1fo0agNZtEnmMc3u_40j2p19Pgz5Y6xiD434zguqGiSol_BOpvyok3DEbp6jjLyyoBxu_DgEXDyzh4g9aY3umhs-Td3BPS6YlEceV0Vdj99GDXEIcmaVJ8qrRHsCbxxoq7-9rjHzemBa3nS_c7gtBlGsII_-XPy_2t8rvjklW5_HcRuJ0vgxqW6oDclRJOSpUIGXhh0n6Iec2HwzCVeyd72779VZgn6lxGfbURr3EHUTzg
I/chromium(22300): [INFO:CONSOLE(3222)] "access token: Atza|IwEBIEhPDjTAXYcqHwnvQcs95LT5SG7jTXjr13Mb2DM5sBSvGgEPQFmURgERJ4mWSSRKYXI_Hk5w7Ti3gp94xA6SlhnR4ke5K1vZgIi8XBh7o611SMbpI3vyg9vnZmZy-c0LvxGeUgzVcaDPrj5Ydw-ZgCPTy35sf6qOEBpvF9walxIym5mZbE47IY_7JHM5pe1EMJmxG4ffXC3Ld1qetV-ew68rDxeHpi5tePXC9yZEDQLLvVeWQ0p512Uokdw2at-g51CfA5g3NKuig4fRKku9A9cC128020gA9ctZTTZctmChGHUMtS43zSPySadeQFdU1fo0agNZtEnmMc3u_40j2p19Pgz5Y6xiD434zguqGiSol_BOpvyok3DEbp6jjLyyoBxu_DgEXDyzh4g9aY3umhs-Td3BPS6YlEceV0Vdj99GDXEIcmaVJ8qrRHsCbxxoq7-9rjHzemBa3nS_c7gtBlGsII_-XPy_2t8rvjklW5_HcRuJ0vgxqW6oDclRJOSpUIGXhh0n6Iec2HwzCVeyd72779VZgn6lxGfbURr3EHUTzg", source: file:///android_asset/www/build/main.js (3222)
D/SystemWebChromeClient(22300): file:///android_asset/www/build/main.js: Line 4302 : ------------------------------------------------------------------
I/chromium(22300): [INFO:CONSOLE(4302)] "------------------------------------------------------------------", source: file:///android_asset/www/build/main.js (4302)
D/AmazonLoginPlugin(22300): Received JSON options
I/AmazonLoginPlugin(22300): Both Authorization started
I/AmazonLoginPlugin(22300): Args: MTA8328, 00109916a208, pQJjoORK-s_1Ay7QM_-YkYYFE6WBjS1S4yanfWhKiHw
I/AmazonLoginPlugin(22300): Profile: profile scope added
I/AmazonLoginPlugin(22300): Profile: alexa pre_auth scope added
I/com.amazon.identity.auth.device.api.authorization.AuthorizationManager(22300): com.buddytalk.setup01 calling authorize
I/com.amazon.identity.auth.device.authorization.InternalAuthManager(22300): com.buddytalk.setup01 calling authorize: scopes=[alexa:all, profile, alexa:voice_service:pre_auth]
I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(22300): isAPIKeyValid : packageName=com.buddytalk.setup01
I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(22300): getAppInfo : packageName=com.buddytalk.setup01
I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(22300): getAppInfoFromAPIKey : packageName=com.buddytalk.setup01
I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(22300): Finding API Key for com.buddytalk.setup01
I/com.amazon.identity.auth.device.utils.ThirdPartyResourceParser(22300): Attempting to parse API Key from assets directory
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): Begin decoding API Key for packageName=com.buddytalk.setup01
I/com.amazon.identity.auth.device.utils.JWTDecoder(22300): Signature match!
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): APIKey:<obscured>
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): verifyPayload for packageName=com.buddytalk.setup01
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Validating MD5 signature in API key:<obscured>
D/com.amazon.identity.auth.device.datastore.AbstractDataSource.PII(22300): Insert Row table=Profile:<obscured>
I/com.amazon.identity.auth.device.utils.PackageSignatureUtil(22300): num sigs = 1
D/com.amazon.identity.auth.device.utils.PackageSignatureUtil.PII(22300): Fingerprint checking:<obscured>
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): Number of signatures = 1
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Fingerprint checking:<obscured>
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Validating SHA256 signature in API key:<obscured>
I/com.amazon.identity.auth.device.utils.PackageSignatureUtil(22300): num sigs = 1
D/com.amazon.identity.auth.device.utils.PackageSignatureUtil.PII(22300): Fingerprint checking:<obscured>
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): Number of signatures = 1
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Fingerprint checking:<obscured>
I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(22300): getAppInfo : packageName=com.buddytalk.setup01
I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(22300): getAppInfoFromAPIKey : packageName=com.buddytalk.setup01
I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(22300): Finding API Key for com.buddytalk.setup01
I/com.amazon.identity.auth.device.utils.ThirdPartyResourceParser(22300): Attempting to parse API Key from assets directory
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): Begin decoding API Key for packageName=com.buddytalk.setup01
I/com.amazon.identity.auth.device.utils.JWTDecoder(22300): Signature match!
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): APIKey:<obscured>
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): verifyPayload for packageName=com.buddytalk.setup01
D/SystemWebChromeClient(22300): file:///android_asset/www/build/main.js: Line 4307 : {"useBuddytalkDsnFilter":true,"amzEmail":"16a208@gmail.com","amzName":"avs16a208","avsBuddytalkSkillUrl":"https://www.amazon.com/dp/B0728LD5QP","buddytalkEnabled":true,"buddytalkUseDefaultUrl":true,"buddytalkUrl":"https://avs.buddytalk.com","buddytalkUser":"","buddytalkPassword":"inno1901qa","buddytalkToken":"","buddytalkEnableSetupSkill":false,"lastUpdateDate":"2018-11-14T23:24:46.171Z","buddytalkDevices":[{"dsn":"10a4be9cb3da","cert":0,"link":0,"vpn":true,"wifi":true,"online":true}]}
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Validating MD5 signature in API key:<obscured>
I/chromium(22300): [INFO:CONSOLE(4307)] "{"useBuddytalkDsnFilter":true,"amzEmail":"16a208@gmail.com","amzName":"avs16a208","avsBuddytalkSkillUrl":"https://www.amazon.com/dp/B0728LD5QP","buddytalkEnabled":true,"buddytalkUseDefaultUrl":true,"buddytalkUrl":"https://avs.buddytalk.com","buddytalkUser":"","buddytalkPassword":"inno1901qa","buddytalkToken":"","buddytalkEnableSetupSkill":false,"lastUpdateDate":"2018-11-14T23:24:46.171Z","buddytalkDevices":[{"dsn":"10a4be9cb3da","cert":0,"link":0,"vpn":true,"wifi":true,"online":true}]}", source: file:///android_asset/www/build/main.js (4307)
D/SystemWebChromeClient(22300): file:///android_asset/www/build/main.js: Line 4309 : updated settings
I/chromium(22300): [INFO:CONSOLE(4309)] "updated settings", source: file:///android_asset/www/build/main.js (4309)
I/com.amazon.identity.auth.device.utils.PackageSignatureUtil(22300): num sigs = 1
D/com.amazon.identity.auth.device.utils.PackageSignatureUtil.PII(22300): Fingerprint checking:<obscured>
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): Number of signatures = 1
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Fingerprint checking:<obscured>
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Validating SHA256 signature in API key:<obscured>
I/com.amazon.identity.auth.device.utils.PackageSignatureUtil(22300): num sigs = 1
D/com.amazon.identity.auth.device.utils.PackageSignatureUtil.PII(22300): Fingerprint checking:<obscured>
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): Number of signatures = 1
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Fingerprint checking:<obscured>
D/com.amazon.identity.auth.device.RequestManager(22300): Executing request 5b13c51d-22a1-477f-be8a-475daf355f6d
D/com.amazon.identity.auth.device.authorization.AuthorizationHelper.PII(22300): Generating Redirect URI:<obscured>
I/com.amazon.identity.auth.device.utils.PackageSignatureUtil(22300): num sigs = 1
D/com.amazon.identity.auth.device.utils.PackageSignatureUtil.PII(22300): Fingerprint checking:<obscured>
I/com.amazon.identity.auth.device.utils.PackageSignatureUtil(22300): num sigs = 1
D/com.amazon.identity.auth.device.utils.PackageSignatureUtil.PII(22300): Fingerprint checking:<obscured>
D/com.amazon.identity.auth.device.authorization.AuthorizationHelper.PII(22300): Generating OAUTH2 URL:<obscured>
I/com.amazon.identity.auth.device.ExternalBrowserManager(22300): Starting External Browser
D/com.amazon.identity.auth.device.api.workflow.RequestContext(22300): RequestContext 79036422-2a51-40c8-a18a-43016cfc351b: onStartRequest for request ID 5b13c51d-22a1-477f-be8a-475daf355f6d
D/com.amazon.identity.auth.device.interactive.GenericInteractiveState(22300): InteractiveState 1e05a1dc-108d-47a9-aee8-c5f9c84c725e: Recording activity request 5b13c51d-22a1-477f-be8a-475daf355f6d
D/SystemAdController( 1373): Activity:ActivityInfo{4299b040 com.android.browser.BrowserActivity}is not the default one
D/AdClientRecord( 1373): Splash target was not initialized.
D/SystemAdController( 1373): Package:com.android.browser is not in the list
D/SystemAdController( 1373): requestSplashScreen duration:1
I/ActivityManager( 1090): START u0 {act=android.intent.action.VIEW dat=https://na.account.amazon.com/ap/oa?response_type=code&redirect_uri=amzn://com.buddytalk.setup01&client_id=amzn1.application-oa2-client.2ab09a87dbb94c3ab7dcdfff5267c196&amzn_respectRmrMeAuthState=1&amzn_showRmrMe=1&amzn_rmrMeDefaultSelected=1&state=clientId=amzn1.application-oa2-client.2ab09a87dbb94c3ab7dcdfff5267c196&redirectUri=amzn://com.buddytalk.setup01&clientRequestId=5b13c51d-22a1-477f-be8a-475daf355f6d&InteractiveRequestType=com.amazon.identity.auth.device.authorization.request.authorize&com.amazon.identity.auth.device.authorization.return_auth_code=true&scope=alexa:all+profile+alexa:voice_service:pre_auth&appIdentifier=eyJTSEEtMjU2IjpbImY1NjdhOWE5MzJhNjlhZDVhMTg1Yzc2MjhlYjQ1M2E3Yzc0YjFlNzQ2NGI4
I/ActivityManager( 1090): N2YwZjQ2MmJhNzEwNTljNWY4NjAiXSwiTUQ1IjpbImU4ZDhlMzU3NGYyYWI5OWY2Y2UwNmEyZTZk
I/ActivityManager( 1090): YTBiYTE0Il0sInBhY2thZ2UiOiJjb20uYnVkZHl0YWxrLnNldHVwMDEifQ==
I/ActivityManager( 1090): &sw_ver=LWAAndroidSDK3.0.4&scope_data={"alexa:all":{"productID":"MTA8328","productInstanceAttributes":{"deviceSerialNumber":"00109916a208"}}}&code_challenge_method=S256&code_challenge=pQJjoORK-s_1Ay7QM_-YkYYFE6WBjS1S4yanfWhKiHw&language=en_US flg=0x50000000 cmp=com.android.browser/.BrowserActivity (has extras)} from pid 22300

10 |2000 characters needed characters left characters exceeded

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

hho-inno avatar image
hho-inno answered ·

Hi,

More logs from further upstream to the previous:

D/AmazonLoginPlugin(22300): Received JSON options
I/AmazonLoginPlugin(22300): Both Authorization started
I/AmazonLoginPlugin(22300): Args: MTA8328, 00109916a208, pQJjoORK-s_1Ay7QM_-YkYYFE6WBjS1S4yanfWhKiHw
I/AmazonLoginPlugin(22300): Profile: profile scope added
I/AmazonLoginPlugin(22300): Profile: alexa pre_auth scope added
I/com.amazon.identity.auth.device.api.authorization.AuthorizationManager(22300): com.buddytalk.setup01 calling authorize
I/com.amazon.identity.auth.device.authorization.InternalAuthManager(22300): com.buddytalk.setup01 calling authorize: scopes=[alexa:all, profile, alexa:voice_service:pre_auth]
I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(22300): isAPIKeyValid : packageName=com.buddytalk.setup01
I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(22300): getAppInfo : packageName=com.buddytalk.setup01
I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(22300): getAppInfoFromAPIKey : packageName=com.buddytalk.setup01
I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(22300): Finding API Key for com.buddytalk.setup01
I/com.amazon.identity.auth.device.utils.ThirdPartyResourceParser(22300): Attempting to parse API Key from assets directory
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): Begin decoding API Key for packageName=com.buddytalk.setup01
I/com.amazon.identity.auth.device.utils.JWTDecoder(22300): Signature match!
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): APIKey:<obscured>
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): verifyPayload for packageName=com.buddytalk.setup01
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Validating MD5 signature in API key:<obscured>
D/com.amazon.identity.auth.device.datastore.AbstractDataSource.PII(22300): Insert Row table=Profile:<obscured>
I/com.amazon.identity.auth.device.utils.PackageSignatureUtil(22300): num sigs = 1
D/com.amazon.identity.auth.device.utils.PackageSignatureUtil.PII(22300): Fingerprint checking:<obscured>
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): Number of signatures = 1
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Fingerprint checking:<obscured>
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Validating SHA256 signature in API key:<obscured>
I/com.amazon.identity.auth.device.utils.PackageSignatureUtil(22300): num sigs = 1
D/com.amazon.identity.auth.device.utils.PackageSignatureUtil.PII(22300): Fingerprint checking:<obscured>
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): Number of signatures = 1
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Fingerprint checking:<obscured>
I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(22300): getAppInfo : packageName=com.buddytalk.setup01
I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(22300): getAppInfoFromAPIKey : packageName=com.buddytalk.setup01
I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(22300): Finding API Key for com.buddytalk.setup01
I/com.amazon.identity.auth.device.utils.ThirdPartyResourceParser(22300): Attempting to parse API Key from assets directory
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): Begin decoding API Key for packageName=com.buddytalk.setup01
I/com.amazon.identity.auth.device.utils.JWTDecoder(22300): Signature match!
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): APIKey:<obscured>
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): verifyPayload for packageName=com.buddytalk.setup01
D/SystemWebChromeClient(22300): file:///android_asset/www/build/main.js: Line 4307 : {"useBuddytalkDsnFilter":true,"amzEmail":"16a208@gmail.com","amzName":"avs16a208","avsBuddytalkSkillUrl":"https://www.amazon.com/dp/B0728LD5QP","buddytalkEnabled":true,"buddytalkUseDefaultUrl":true,"buddytalkUrl":"https://avs.buddytalk.com","buddytalkUser":"","buddytalkPassword":"inno1901qa","buddytalkToken":"","buddytalkEnableSetupSkill":false,"lastUpdateDate":"2018-11-14T23:24:46.171Z","buddytalkDevices":[{"dsn":"10a4be9cb3da","cert":0,"link":0,"vpn":true,"wifi":true,"online":true}]}
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Validating MD5 signature in API key:<obscured>
I/chromium(22300): [INFO:CONSOLE(4307)] "{"useBuddytalkDsnFilter":true,"amzEmail":"16a208@gmail.com","amzName":"avs16a208","avsBuddytalkSkillUrl":"https://www.amazon.com/dp/B0728LD5QP","buddytalkEnabled":true,"buddytalkUseDefaultUrl":true,"buddytalkUrl":"https://avs.buddytalk.com","buddytalkUser":"","buddytalkPassword":"inno1901qa","buddytalkToken":"","buddytalkEnableSetupSkill":false,"lastUpdateDate":"2018-11-14T23:24:46.171Z","buddytalkDevices":[{"dsn":"10a4be9cb3da","cert":0,"link":0,"vpn":true,"wifi":true,"online":true}]}", source: file:///android_asset/www/build/main.js (4307)
D/SystemWebChromeClient(22300): file:///android_asset/www/build/main.js: Line 4309 : updated settings
I/chromium(22300): [INFO:CONSOLE(4309)] "updated settings", source: file:///android_asset/www/build/main.js (4309)
I/com.amazon.identity.auth.device.utils.PackageSignatureUtil(22300): num sigs = 1
D/com.amazon.identity.auth.device.utils.PackageSignatureUtil.PII(22300): Fingerprint checking:<obscured>
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): Number of signatures = 1
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Fingerprint checking:<obscured>
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Validating SHA256 signature in API key:<obscured>
I/com.amazon.identity.auth.device.utils.PackageSignatureUtil(22300): num sigs = 1
D/com.amazon.identity.auth.device.utils.PackageSignatureUtil.PII(22300): Fingerprint checking:<obscured>
I/com.amazon.identity.auth.device.appid.APIKeyDecoder(22300): Number of signatures = 1
D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(22300): Fingerprint checking:<obscured>
D/com.amazon.identity.auth.device.RequestManager(22300): Executing request 5b13c51d-22a1-477f-be8a-475daf355f6d
D/com.amazon.identity.auth.device.authorization.AuthorizationHelper.PII(22300): Generating Redirect URI:<obscured>
I/com.amazon.identity.auth.device.utils.PackageSignatureUtil(22300): num sigs = 1
D/com.amazon.identity.auth.device.utils.PackageSignatureUtil.PII(22300): Fingerprint checking:<obscured>
I/com.amazon.identity.auth.device.utils.PackageSignatureUtil(22300): num sigs = 1
D/com.amazon.identity.auth.device.utils.PackageSignatureUtil.PII(22300): Fingerprint checking:<obscured>
D/com.amazon.identity.auth.device.authorization.AuthorizationHelper.PII(22300): Generating OAUTH2 URL:<obscured>
I/com.amazon.identity.auth.device.ExternalBrowserManager(22300): Starting External Browser
D/com.amazon.identity.auth.device.api.workflow.RequestContext(22300): RequestContext 79036422-2a51-40c8-a18a-43016cfc351b: onStartRequest for request ID 5b13c51d-22a1-477f-be8a-475daf355f6d
D/com.amazon.identity.auth.device.interactive.GenericInteractiveState(22300): InteractiveState 1e05a1dc-108d-47a9-aee8-c5f9c84c725e: Recording activity request 5b13c51d-22a1-477f-be8a-475daf355f6d
D/SystemAdController( 1373): Activity:ActivityInfo{4299b040 com.android.browser.BrowserActivity}is not the default one
D/AdClientRecord( 1373): Splash target was not initialized.
D/SystemAdController( 1373): Package:com.android.browser is not in the list
D/SystemAdController( 1373): requestSplashScreen duration:1
I/ActivityManager( 1090): START u0 {act=android.intent.action.VIEW dat=https://na.account.amazon.com/ap/oa?response_type=code&redirect_uri=amzn://com.buddytalk.setup01&client_id=amzn1.application-oa2-client.2ab09a87dbb94c3ab7dcdfff5267c196&amzn_respectRmrMeAuthState=1&amzn_showRmrMe=1&amzn_rmrMeDefaultSelected=1&state=clientId=amzn1.application-oa2-client.2ab09a87dbb94c3ab7dcdfff5267c196&redirectUri=amzn://com.buddytalk.setup01&clientRequestId=5b13c51d-22a1-477f-be8a-475daf355f6d&InteractiveRequestType=com.amazon.identity.auth.device.authorization.request.authorize&com.amazon.identity.auth.device.authorization.return_auth_code=true&scope=alexa:all+profile+alexa:voice_service:pre_auth&appIdentifier=eyJTSEEtMjU2IjpbImY1NjdhOWE5MzJhNjlhZDVhMTg1Yzc2MjhlYjQ1M2E3Yzc0YjFlNzQ2NGI4
I/ActivityManager( 1090): N2YwZjQ2MmJhNzEwNTljNWY4NjAiXSwiTUQ1IjpbImU4ZDhlMzU3NGYyYWI5OWY2Y2UwNmEyZTZk
I/ActivityManager( 1090): YTBiYTE0Il0sInBhY2thZ2UiOiJjb20uYnVkZHl0YWxrLnNldHVwMDEifQ==
I/ActivityManager( 1090): &sw_ver=LWAAndroidSDK3.0.4&scope_data={"alexa:all":{"productID":"MTA8328","productInstanceAttributes":{"deviceSerialNumber":"00109916a208"}}}&code_challenge_method=S256&code_challenge=pQJjoORK-s_1Ay7QM_-YkYYFE6WBjS1S4yanfWhKiHw&language=en_US flg=0x50000000 cmp=com.android.browser/.BrowserActivity (has extras)} from pid 22300

....

I/Analytics( 3193): start session(com.android.browser)
W/AwContents( 3193): onDetachedFromWindow called when already detached. Ignoring
W/ScreenOrientationListener( 3193): Removing an inexistent observer!
W/IInputConnectionWrapper(22300): showStatusIcon on inactive InputConnection
I/ActivityManager( 1090): Displayed com.android.browser/.BrowserActivity: +285ms (total +52s699ms)
D/PowerKeeperEventLogManager( 1589): updatestatusbar value 0x40
D/PhoneStatusBar( 1158): disable: 0x00000000 -> 0x00000040 (diff: 0x00000040)
D/PhoneStatusBar( 1158): disable: < expand icons alerts ticker system_info back home recent clock full hide keyguard >
I/Timeline( 3193): Timeline: Activity_idle id: android.os.BinderProxy@42a2c050 time:10068141
W/AwContents( 3193): onDetachedFromWindow called when already detached. Ignoring
D/dalvikvm( 3193): GC_FOR_ALLOC freed 1169K, 11% free 24633K/27592K, paused 22ms, total 23ms
D/PhoneStatusBar( 1158): removeNotification key=android.os.BinderProxy@42b4ddf0 old=StatusBarNotification(pkg=com.android.browser user=UserHandle{0} id=0 tag=u score=0: Notification(pri=0 contentView=com.android.browser/0x7f040072 vibrate=null sound=null defaults=0x0 flags=0x22 kind=[null]))
W/ContextImpl( 1158): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1165 android.content.ContextWrapper.sendBroadcast:365 com.android.systemui.statusbar.phone.PhoneStatusBar.updateAppMessage:1658 com.android.systemui.statusbar.phone.PhoneStatusBar.updateAppMessage:1650 com.android.systemui.statusbar.phone.PhoneStatusBar.removeNotification:2300
D/PhoneStatusBar( 1158): addNotification pkg=com.android.browser;basepkg=com.android.browser;id=0
D/SizeAdaptiveLayout( 1158): com.android.internal.widget.SizeAdaptiveLayout{42babd80 V.E..... ......I. 0,0-0,0 #7f0800b8 app:id/adaptive}child view android.widget.LinearLayout{42e84f50 G.E..... ......I. 0,0-0,0} measured out of bounds at 129px clamped to 130px
W/System.err( 3193): java.net.MalformedURLException: Unknown protocol: amzn
W/System.err( 3193): at java.net.URL.<init>(URL.java:182)
W/System.err( 3193): at java.net.URL.<init>(URL.java:125)
W/System.err( 3193): at com.android.browser.iI.a(UrlHandler.java:100)
W/System.err( 3193): at com.android.browser.bE.a(Controller.java:1666)
W/System.err( 3193): at com.android.browser.hP.shouldOverrideUrlLoading(Tab.java:898)
W/System.err( 3193): at com.miui.com.android.webview.chromium.WebViewContentsClientAdapter.shouldOverrideUrlLoading(WebViewContentsClientAdapter.java:346)
W/System.err( 3193): at com.miui.org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(AwContentsClientBridge.java:261)
W/System.err( 3193): at com.miui.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
W/System.err( 3193): at com.miui.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:48)
W/System.err( 3193): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 3193): at android.os.Looper.loop(Looper.java:136)
W/System.err( 3193): at android.app.ActivityThread.main(ActivityThread.java:5052)
W/System.err( 3193): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 3193): at java.lang.reflect.Method.invoke(Method.java:515)
W/System.err( 3193): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
W/System.err( 3193): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
W/System.err( 3193): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
W/System.err( 3193): at dalvik.system.NativeStart.main(Native Method)
D/SystemAdController( 1373): Activity:ActivityInfo{4299d4e0 com.amazon.identity.auth.device.workflow.WorkflowActivity}is not the default one
D/AdClientRecord( 1373): Splash target was not initialized.
D/SystemAdController( 1373): Package:com.buddytalk.setup01 is not in the list
D/SystemAdController( 1373): requestSplashScreen duration:1
I/ActivityManager( 1090): START u0 {act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=amzn://com.buddytalk.setup01?error_description=An+unknown+scope+was+requested&state=clientId=amzn1.application-oa2-client.2ab09a87dbb94c3ab7dcdfff5267c196&redirectUri=amzn://com.buddytalk.setup01&clientRequestId=5b13c51d-22a1-477f-be8a-475daf355f6d&InteractiveRequestType=com.amazon.identity.auth.device.authorization.request.authorize&com.amazon.identity.auth.device.authorization.return_auth_code=true&error=invalid_scope cmp=com.buddytalk.setup01/com.amazon.identity.auth.device.workflow.WorkflowActivity (has extras)} from pid 3193
W/ScreenOrientationListener( 3193): Removing an inexistent observer!
I/Analytics( 3193): end session(com.android.browser)
D/PowerKeeperEventLogManager( 1589): notifyForegroundCompomentChanged ComponentInfo{com.buddytalk.setup01/com.amazon.identity.auth.device.workflow.WorkflowActivity}
D/com.amazon.identity.auth.device.workflow.WorkflowActivity(22300): onCreate
D/com.amazon.identity.auth.device.workflow.WorkflowActivity(22300): Receiving response for interactive request
D/com.amazon.identity.auth.device.workflow.WorkflowActivity(22300): Receiving response for request 5b13c51d-22a1-477f-be8a-475daf355f6d
D/com.amazon.identity.auth.device.ResponseManager(22300): Recording pending response for request ID 5b13c51d-22a1-477f-be8a-475daf355f6d
D/com.amazon.identity.auth.device.workflow.WorkflowActivity(22300): finish
D/PhoneStatusBar( 1158): disable: 0x00000040 -> 0x00000000 (diff: 0x00000040)
D/PhoneStatusBar( 1158): disable: < expand icons alerts ticker system_info back home recent clock full hide keyguard >

10 |2000 characters needed characters left characters exceeded

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

hho-inno avatar image
hho-inno answered ·

Hi,

Trying to put relevant bits of our code into the code that is on Amazon's instructions ( https://developer.amazon.com/docs/alexa-voice-service/authorize-companion-app.html ) and I we might have found a typo here:

.addScope(ScopeFactory.scopeNamed("alexa:voice_service:pre_auth"),
ScopeFactory.scopeNamed("alexa:all", scopeData))

Shouldn't it be:

.addScopes(ScopeFactory.scopeNamed("alexa:voice_service:pre_auth"),
ScopeFactory.scopeNamed("alexa:all", scopeData))

BTW also getting the same kind'a error using the LoginWithAmazonActivity.java sample code as the template. Probably API_KEY isn't the matching one to our device... But same "invalid scope" and not invalid device or key or something.

E/com.amazon.identity.auth.device.lwaapp.LoginWithAmazonActivity(23760): AuthError during authorization
E/com.amazon.identity.auth.device.lwaapp.LoginWithAmazonActivity(23760): AuthError cat= INTERNAL type=ERROR_SERVER_REPSONSE - com.amazon.identity.auth.device.AuthError: Error=invalid_scope error_description=An unknown scope was requested

Thanks!

1 comment
10 |2000 characters needed characters left characters exceeded

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

Good catch. The typo has been fixed in the docs!

0 Likes 0 ·
Saravana@Amazon avatar image
Saravana@Amazon answered ·

@NewUser-1434cb60-0266-4056-aefc-f18b3e6898f7,

I think you're correct. It should be like below.

.addScopes(ScopeFactory.scopeNamed("alexa:voice_service:pre_auth"),
ScopeFactory.scopeNamed("alexa:all", scopeData))

Are you still having an error after correcting this typo error?

10 |2000 characters needed characters left characters exceeded

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