Files
old-tellall/web/README.md

82 lines
4.1 KiB
Markdown
Raw Normal View History

2018-01-05 01:00:10 +01:00
To obtain new Auth Code :
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
https://www.amazon.com/ap/oa?client_id=amzn1.application-oa2-client.c748ca56ded04a95b236979898585ff7&scope=alexa::ask:skills:readwrite alexa::ask:models:readwrite alexa::ask:skills:test&response_type=code&redirect_uri=https://layla.amazon.com/api/skill/link/M2ODJY6EXOY6KO
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
Response URL (Decoded) :
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
https://layla.amazon.com/api/skill/link/M2ODJY6EXOY6KO?code=ANCgZUfEFdlRRkpSNFuA&scope=alexa::ask:skills:readwrite alexa::ask:models:readwrite alexa::ask:skills:test
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
Code : ANCgZUfEFdlRRkpSNFuA
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
=======================================
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
Now to get Access Token :
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
Send a POST request to https://api.amazon.com/auth/o2/token with the following parameters
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
- HTTP Header Parameters
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
Content-Type: application/x-www-form-urlencoded
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
- HTTP Body Parameters
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
grant_type: authorization_code
code: The authorization code that was returned in the response.
client_id: The products client ID. To access this information, navigate to Amazons Developer Console. After youve logged in, click Get Started > under Alexa Voice Service, then click Edit next to a registered product (or create a new one). From the left navigation select Security Profile. This page contains both Client ID and Client Secret for your product.
client_secret: The products client secret. To access this information, navigate to Amazons Developer Console. After youve logged in, click Get Started > under Alexa Voice Service, then click Edit next to a registered product (or create a new one). From the left navigation select Security Profile. This page contains both Client ID and Client Secret for your product.
redirect_uri: One of the return URIs that you added to your apps security profile when signing up.
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
Response :
2017-11-30 17:43:24 +01:00
{
2018-01-08 13:53:50 +01:00
"access_token": "Atza|...",
"refresh_token": "Atzr|...",
2018-01-05 01:00:10 +01:00
"token_type": "bearer",
"expires_in": 3600
2017-11-30 17:43:24 +01:00
}
2018-01-05 01:00:10 +01:00
================================
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
Now to get new Access token using refresh token :
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
Send a POST request to https://api.amazon.com/auth/o2/token with the following parameters:
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
- HTTP Header Parameters
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
Content-Type: application/x-www-form-urlencoded
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
- HTTP Body Parameters
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
grant_type: refresh_token
refresh_token: The URL-encoded refresh token returned with the last request for a new access token.
client_id: To access this information, navigate to Amazons Developer Console. After youve logged in, click Get Started > under Alexa Voice Service, then click Edit next to a registered product (or create a new one). From the left navigation select Security Profile. This page contains both Client ID and Client Secret for your product.
client_secret: The websites client secret. To access this information, navigate to Amazons Developer Console. After youve logged in, click Get Started > under Alexa Voice Service, then click Edit next to a registered product (or create a new one). From the left navigation select Security Profile. This page contains both Client ID and Client Secret for your product.
2017-11-30 17:43:24 +01:00
2018-01-05 01:00:10 +01:00
Response :
2017-11-30 17:43:24 +01:00
{
2018-01-08 13:53:50 +01:00
"access_token": "Atza|...",
"refresh_token": "Atzr|...",
2018-01-05 01:00:10 +01:00
"token_type": "bearer",
"expires_in": 3600
2017-11-30 17:43:24 +01:00
}
2018-01-08 13:53:50 +01:00
=======================
=======================
Prerequests for step 3 :
Database (tellall) with collection (skill_list)
Insert dummy skill with : db.skill_list.insert({"skillID" : "amzn1.ask.skill.efbf0564-a732-4ba9-958f-57939138adae", "intents" : [ { "intentName" : "GetFirstQuestion", "questions" : [ "tell me something about projects", "tell me all about projects" ], "answer" : "blablabla bla bla" }, { "intentName" : "GetThirdQuestion", "questions" : [ "Give me third question" ], "answer" : "This is answer to the third question" } ], "invocationName" : "Saburly", "invocationAnswer" : "We are Saburly team one" })
obtain _id and change in web/src/App.js
enter web/ dir and run "npm run build"
Database (tellall) with collection (token_list)
Insert tokens with : db.token_list.insert({"id" : 1, "refresh_token" : "...", "access_token" : "...", "expires_in" : 1515173601.754 })
(Change refresh_token and access_token dots with real ones)
Set skill_id, client_id and client_secret to appropriate values
Start backend service from backend/ running "node express.js"