Skip to content

Instantly share code, notes, and snippets.

@trylovetom
Created March 6, 2018 05:00
Show Gist options
  • Save trylovetom/acdeb8b090ec89fec2f1fe2fa0986095 to your computer and use it in GitHub Desktop.
Save trylovetom/acdeb8b090ec89fec2f1fe2fa0986095 to your computer and use it in GitHub Desktop.

Revisions

  1. trylovetom created this gist Mar 6, 2018.
    20 changes: 20 additions & 0 deletions LocalTest.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    const AWS = require('aws-sdk')

    AWS.config.region = 'us-east-1'

    // Functions
    const getCredentials = IdentityId => {
    const cognito = new AWS.CognitoIdentity({ apiVersion: '2014-06-30' })
    const params = {
    IdentityId
    }
    return cognito.getCredentialsForIdentity(params).promise()
    }

    getCredentials('...')
    .then(data => {
    console.log(JSON.stringify(data, null, 2))
    })
    .catch(err => {
    console.log(err)
    })