Files
old-tellall/web/README.md
2018-01-08 13:53:50 +01:00

4.1 KiB
Raw Blame History

To obtain new Auth Code :

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

Response URL (Decoded) :

https://layla.amazon.com/api/skill/link/M2ODJY6EXOY6KO?code=ANCgZUfEFdlRRkpSNFuA&scope=alexa::ask:skills:readwrite alexa::ask:models:readwrite alexa::ask:skills:test

Code : ANCgZUfEFdlRRkpSNFuA

=======================================

Now to get Access Token :

Send a POST request to https://api.amazon.com/auth/o2/token with the following parameters

  • HTTP Header Parameters

     Content-Type: application/x-www-form-urlencoded
    
  • HTTP Body Parameters

     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.
    

Response :

{ "access_token": "Atza|...", "refresh_token": "Atzr|...", "token_type": "bearer", "expires_in": 3600 }

================================

Now to get new Access token using refresh token :

Send a POST request to https://api.amazon.com/auth/o2/token with the following parameters:

- HTTP Header Parameters

	Content-Type: application/x-www-form-urlencoded

- HTTP Body Parameters

	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.

Response :

{ "access_token": "Atza|...", "refresh_token": "Atzr|...", "token_type": "bearer", "expires_in": 3600 }

=======================

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"