最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Uncaught Error: Both UserPoolId and ClientId are required - Stack Overflow

programmeradmin8浏览0评论

i'm working on amplify auth to signin with cognito in vue js apps, following is the code i've added in 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,
      },
    });

but somehow i'm receive this kind of error:

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)

i've tried many ways following the reference video and aws amplify documentation. but still same error still occured and my page is blank with the error in console. checked the Auth option and all was good and right. how do i overe this error? i'm also not using any client secret hash as js sdk not worked with app client with secret hash

i'm working on amplify auth to signin with cognito in vue js apps, following is the code i've added in 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,
      },
    });

but somehow i'm receive this kind of error:

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)

i've tried many ways following the reference video and aws amplify documentation. but still same error still occured and my page is blank with the error in console. checked the Auth option and all was good and right. how do i overe this error? i'm also not using any client secret hash as js sdk not worked with app client with secret hash

Share Improve this question edited Jul 1, 2021 at 9:36 Khairul Habib asked Jul 1, 2021 at 9:04 Khairul HabibKhairul Habib 4712 gold badges13 silver badges32 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

The config parameter names need to be

...
userPoolId: '...'
userPoolWebClientId: '...'
...

as defined here: https://github./aws-amplify/amplify-js/blob/a047ce73abe98c3bf82e888c3afb4d2f911805f3/packages/auth/src/types/Auth.ts#L40

发布评论

评论列表(0)

  1. 暂无评论