admin管理员组

文章数量:1402031

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

本文标签: javascriptUncaught Error Both UserPoolId and ClientId are requiredStack Overflow