alexa / alexa-skills-kit-sdk-for-python

The Alexa Skills Kit SDK for Python helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
https://developer.amazon.com/en-US/docs/alexa/alexa-skills-kit-sdk-for-python/overview.html
Apache License 2.0
812 stars 206 forks source link

how to get accessToken to get Customer Contact information using ask-sdk Python #151

Closed ghost closed 4 years ago

ghost commented 4 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[x] Other... Please describe: I'm trying to get the customer contact information like 
the name after launching the custom skill I created as stated on the 
"Request Customer Contact Information for Use in Your Skill" documentation 
but I'm lost as to where I can get this accessToken as described on the docs

accessToken = this.event.context.System.apiAccessToken

I tried getting it from get_api_access_token()
but when I check the cloudwatch logs I always get a 401 response code.

Host: api.amazonalexa.com
Accept: application/json
Authorization: Bearer MQEWY...6fnLok
GET https://api.amazonalexa.com/v2/accounts/~current/settings/Profile.name

    h = {
        'Host': url,
        'Accept': 'application/json',
        'Authorization': f"Bearer {auth_token}"
    }
    response = requests.get(f"https://{url}{full_name}", headers=h)

i think I followed the right format as above but I'm not getting anywhere. 
I badly need help from you guys. I'm not even sure if I'm sending this question
properly... :(

I can't find the right accessToken to pass to the request i'm sending to get the customer profile name. i have no experience in coding and I hope someone can help

Your Environment

Python version info

ghost commented 4 years ago

sorry for bothering you guys. I was able to figure it out on my own. Thanks!