简体   繁体   中英

Alexa Skill Access Token Out of Session

For an Alexa Skill user that has completed account linking - is a way to get their account linking accessToken outside of the skill session?

For example I know that as part of the out of session Skill Messaging API - you can do this to get the skillMessagingToken :

SKILL_CLIENT_ID='YOUR_SKILL_CLIENT_ID'
SKILL_CLIENT_SECRET='YOUR_SKILL_CLIENT_SECRET'
API_URL='https://api.amazon.com/auth/O2/token'
curl -k -X POST \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -d "grant_type=client_credentials&scope=alexa:skill_messaging&client_id=$SKILL_CLIENT_ID&client_secret=$SKILL_CLIENT_SECRET" \
    $API_URL

Rather than using the scope alexa:skill_messaging maybe there's another scope value that returns the user's account linking accessToken ?

Any scope provides an access token. The scope determines what you can do with the access token, not whether or not you get one.

Edit

The "out of session" example above retrieves a token assigned to your skill, not a specific user. But the account linking access token is assigned to a specific customer and is returned from a successful authorization from the customer.

There is a linking workflow that doesn't necessarily involve a skill session or the Alexa app.

https://developer.amazon.com/en-US/docs/alexa/account-linking/app-to-app-account-linking-starting-from-your-app.html

As for the scope, you specify that in the skill linking config in your skill config. So the scope is what you specify. For Login with Amazon, the basic profile scope is usually all that's needed as it will give you a unique user ID for the customer that will be the same across your skill and your external app(s).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM