AWS Cognito访问令牌Javascript

问题描述 投票:-1回答:1

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

javascript amazon-web-services access-token amazon-cognito aws-cognito
1个回答
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
© www.soinside.com 2019 - 2024. All rights reserved.