I have "App-to-App Account Linking" working now.
I gave permission:But when I doing rest api put or get request:
GET /v1/skills/amzn1.ask.skill.cfd5fba9-3f4c-4c57-b836-7c7766d34ad3/stages/development/enablement HTTP/1.1 Authorization: Bearer {TOKEN THAT I REACIEVE WITH authorizeResult.getAccessToken() FROM LWA (Android)} Host: api.amazonalexa.com
it returns to me:
{ "message": "User has not consented to this operation." }
So what am I doing wrong here?
Then I was thinking maybe i'm using wrong post request. So i used hits one:
https://developer.amazon.com/en-US/docs/alexa/account-linking/skill-activation-api.html#enable-and-link
but when im doing post request:
POST /v1/users/~current/skills/amzn1.ask.skill.cfd5fba9-3f4c-4c57-b836-7c7766d34ad3/enablement HTTP/1.1 Authorization: Bearer TOKEN THAT I REACIEVE WITH authorizeResult.getAccessToken() FROM LWA (Android) Content-Type: application/json Content-Length: 186 { "stage": "development", "accountLinkRequest": { "redirectUri": "https://BLEPluginTest.ivg.com", "authCode": "Code I got after doing appToapp linking", "type": "AUTH_CODE" } }
I still receive:
{ "message": "The authentication token is invalid or doesn't have access to make this request" }
P.S.
Maybe I need to use "AuthorizationCode" and not "AccessToken"? But documentation says:
Each API request must have an Authorization header whose value should be the access token retrieved from Login with Amazon.
Additionally android LWA returns them as null.
Everything except for "AccessToken" and User is null.
And to get User I have to use "User.fetch". "authorizeResult.getUser()" return null as well.
The user is signed in user:com.amazon.identity.auth.device.api.authorization.User@ce69d775={userInfo={name=**** *****, user_id=amzn1.account.*****, email=*****@gmail.com}} getAccessToken:Atza|************************************************* getAuthorizationCode():null getClientId():null getRedirectURI():null getUser():null
P.S.S.
I deleted my prev question about "wrong scope". This thread helped me:
https://forums.developer.amazon.com/questions/219022/app-to-app-account-linking-invalid-scope.html
You guys need to update your documentation and change "client id" to "alexa client id" and maybe attach screen or something, to make it more clear because even though u wrote this:
Client ID : The client ID that the developer console provides when you enable app-to-app account linking in the developer console.
Its still not completely clear that u had to use "Alexa client id" and not "your client id".