Skip to content

Instantly share code, notes, and snippets.

View marcelobern's full-sized avatar

Marcelo Bernardes marcelobern

View GitHub Profile
@marcelobern
marcelobern / smapi token.md
Created September 4, 2018 05:00
Alexa SMAPI access token (Login with Amazon)

Before invoking SMAPI operations, it is necessary to obtain an access token from Login with Amazon to authenticate your request.

If you intend to use node-alexa-smapi you will need to retreive a refresh token, so here are a few ways to retrieve an initial refresh token:

Option 1 use ask util generate-lwa-tokens (for more information see: https://developer.amazon.com/docs/smapi/ask-cli-command-reference.html#util-command)

Option 2 use Postman to create an auth request and retrieve a token: 1- Under authorization select Type "OAuth 2.0" and click on "Get New Access Token". 2- Complete the form with the following data:

  • grant type: autorization code
@marcelobern
marcelobern / alexa-sdk-fsm-original.js
Created February 24, 2017 07:50
Node.js Alexa skill: alexa-sdk or alexa-app?
// Original code snippet from https://github.com/alexa/skill-sample-nodejs-decision-tree/blob/master/src/index.js
// set state to start up and welcome the user
var newSessionHandler = {
'LaunchRequest': function () {
this.handler.state = states.STARTMODE;
this.emit(':ask', welcomeMessage, repeatWelcomeMessage);
},'AMAZON.HelpIntent': function () {
this.handler.state = states.STARTMODE;
this.emit(':ask', helpMessage, helpMessage);
},