项目作者: domdomegg

项目描述 :
🧬 Alexa skill demoing the GenomeLink API in AWS Lambda
高级语言: JavaScript
项目地址: git://github.com/domdomegg/genomelink-aws-lambda-demo.git
创建时间: 2018-04-06T00:08:04Z
项目社区:https://github.com/domdomegg/genomelink-aws-lambda-demo

开源协议:The Unlicense

下载


genomelink-aws-lambda-demo

Demo Alexa skill showing the GENOME LINK API working in AWS Lambda with no extra modules. Also a guide below on how to use the GENOME LINK API with Alexa, including setting up Account Linking with OAuth.

Also file called keybits.js for others to use as they please to get started using the GENOME LINK API only requiring the https library.

Licensed via The Unlicense into the public domain so hopefully you can build on it!

Oauth and the Alexa skills kit

To use the GENOME LINK API with Alexa, first register a new app in the GENOME LINK “My Apps” page. Make sure you’re logged into your own account and not a test user.

Give it any sensible name. In the GENOME LINK Redirect URIs field copy and paste the three Redirect URLs from the bottom of the Account Linking page in the Alexa Skills Kit Developer Console. They should look something like:

  1. https://alexa.amazon.co.jp/api/skill/link/NUMBERSANDLETTERS
  2. https://pitangui.amazon.com/api/skill/link/NUMBERSANDLETTERS
  3. https://layla.amazon.com/api/skill/link/NUMBERSANDLETTERS

Create the app, and click edit on the Authorization scopes. Tick whichever traits you want to use in your app, then click save at the bottom.

Now in on the Account Linking page in the Alexa Skills Kit Developer Console enter the following details:


Authorization Grant Type

Auth Code Grant

Authorization URI

https://genomelink.io/oauth/authorize

Access Token URI

https://genomelink.io/oauth/token

Client ID

Copy and paste your Client id from the GENOME LINK app page

Client Secret

Copy and paste your Client secret from the GENOME LINK app page

Client Authentication Scheme

HTTP Basic

Scope

Add so they match GENOME LINK (e.g. report:blood-glucose)

You can now get the user’s access token in AWS Lambda using this.event.session.user.accessToken.