AWS Cognito / aws-amplify errors - crypto undefined

时间:2018-06-08 02:39:39

标签: amazon-web-services aws-sdk amazon-cognito aws-amplify

我正在尝试为aws cognito创建一个vuejs包装器,并且我的API遇到了问题。文档很差,但我所拥有的是在控制台中给我一个"Cannot read property 'crypto' of undefined

设置配置放大

import Amplify, { Auth } from 'aws-amplify'
import { CognitoUser } from 'amazon-cognito-identity-js'

Amplify.configure({
      Auth: {
        // REQUIRED - Amazon Cognito Identity Pool ID
        identityPoolId: config.IdentityPoolId,
        // REQUIRED - Amazon Cognito Region
        region: config.Region,
        // OPTIONAL - Amazon Cognito User Pool ID
        userPoolId: config.UserPoolId,
        // OPTIONAL - Amazon Cognito Web Client ID (26-char alphanumeric string)
        userPoolWebClientId: config.ClientId,
        // OPTIONAL - Enforce user authentication prior to accessing AWS resources or not
        mandatorySignIn: false,
      }
    });

这是在初始化时运行以导致错误的所有代码。我究竟做错了什么?我只是希望能够访问Auth来调用方法。

为清楚起见,我正在导出一个函数来注册vuex模块,下面的代码(除了导入)在init操作中。

export default (store, config, namespace = 'cognito') => {
  store.registerModule(namespace, {
    namespaced: true,
    state,
    getters,
    mutations,
    actions
  })
  store.dispatch(`${namespace}/init`, config)
}

0 个答案:

没有答案