-1

我正在使用与Alexa链接并获取accessToken的帐户。我正在使用AWS Cognito进行身份验证。我的假设是accessToken是AWS Cognito的令牌 - 但我该如何使用它?我需要获取CognitoUser信息。我见过使用Facebook SDK的例子,简单地说Fb.setToken(accessToken)很愚蠢,但我找不到Cognito的等价物。我错过了什么?!AWS Cognito访问令牌Javascript

回答

0

这是我的认证流程,只使用cognito,对我来说工作得很好:

var authenticationData = { 
    Username: document.getElementById("user").value, 
    Password: document.getElementById("password").value 
    }; 

    var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails(authenticationData); 

    var poolData = { 
    UserPoolId: AWSConfiguration.UserPoolId, 
    ClientId: AWSConfiguration.ClientAppId 
    }; 

    userPool = new AmazonCognitoIdentity.CognitoUserPool(poolData); 

    var userData = { 
    Username: document.getElementById("user").value, 
    Pool: userPool 
    }; 

    var cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData); 

    cognitoUser.authenticateUser(authenticationDetails, { 

    // authenticate here 
相关问题