Created
July 20, 2016 05:25
-
-
Save apeque/1e2046b0d6ed0e1addb0e784a161c81f to your computer and use it in GitHub Desktop.
AWS Cognito Twitter Auth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var awssdk = require('aws-sdk'); | |
| awssdk.config = new awssdk.Config(); | |
| awssdk.config.accessKeyId = self.config.aws.id; | |
| awssdk.config.secretAccessKey = self.config.aws.secret; | |
| awssdk.config.region = self.config.aws.region; | |
| // token and secret variables obtained from Twitter | |
| // oAuth flow; same tokens work to query Twitter REST API. | |
| var params = { | |
| IdentityPoolId: self.config.aws.pool, | |
| Logins: { | |
| 'api.twitter.com': token + ';' + secret | |
| } | |
| }; | |
| awssdk.config.credentials = new awssdk.CognitoIdentityCredentials(params); | |
| awssdk.config.credentials.get(function(err){ | |
| console.log(err); | |
| }); | |
| // Error: NotAuthorizedException: Invalid login token. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment