jeudi 29 janvier 2015

AWS, Amazon, Cognito and DynamoDB from NODEJS RESTAPI

we developing a REST API in NodeJS and use DynamoDB as database,


i pretend use Cognito for handle Auth multiple accounts, but in examples allways first get cognitoID and later use DynamoDB, its not posible send cognitoID to client and use this id or somthing similar like credential to access to DynamoDB whitout refind CognitoID??



FB.login(function (response) {
if (response.authResponse) { // logged in
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: 'us-east-1:1699ebc0-7900-4099-b910-2df94f52a030',
Logins: {
'graph.facebook.com': response.authResponse.accessToken
}
});

AWS.config.credentials.get(err,data){
console.log('You are now logged in.');
//Here i can use Dynamo without any problem,
//but i allways need save Facebook Token ID and get CognitoID
//for ALL the connections
//there is no way to save CognitoID and use this
//The ID of my users in Dynamo is CognitoID
var db = new AWS.DynamoDB();
db.listTables(function(err, data) {
console.log(data.TableNames);
});
}
} else {
console.log('There was a problem logging you in.');
}
});




Aucun commentaire:

Enregistrer un commentaire