我正在研究在 vue js 应用程序中使用 cognito 进行放大身份验证,以下是我在 main.js 中添加的代码:
import Amplify from 'aws-amplify';
Amplify.configure({
Auth: {
mandatorySignIn: false,
region: config.cognito.REGION,
userPoolId: config.cognito.USER_POOL_ID,
UserPoolClientId: config.cognito.APP_CLIENT_ID,
},
});
但不知何故我收到了这种错误:
CognitoUserPool.js?17a7:46 Uncaught Error: Both UserPoolId and ClientId are required.
at new CognitoUserPool (CognitoUserPool.js?17a7:46)
at AuthClass.configure (Auth.js?bf82:183)
at eval (Amplify.js?7d03:83)
at Array.map (<anonymous>)
at AmplifyClass.configure (Amplify.js?7d03:82)
at eval (main.js?56d7:15)
at Module../src/main.js (app.js:1692)
at __webpack_require__ (app.js:854)
at fn (app.js:151)
at Object.1 (app.js:2809)
我按照参考视频和 aws amplify 文档尝试了多种方法。但仍然发生相同的错误,我的页面是空白的,控制台中出现错误。 检查了 Auth 选项,一切都很好。我该如何克服这个错误?我也没有使用任何客户端秘密哈希,因为 js sdk 无法与具有秘密哈希的应用程序客户端一起使用
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
配置参数的名称需要如下:
在这里定义:https://github.com/aws-amplify/amplify-js/blob/a047ce73abe98c3bf82e888c3afb4d2f911805f3/packages/auth/src/types/Auth.ts#L40