Create cognito pool id from aws cli or nodeJS got error, what's wrong with the params?

349
January 31, 2017, at 8:48 PM

I created nodeJS scripts to setup my AWS Cognito Pool ID using class "CreateIdentityPool":

var cognitoidentity = new AWS.CognitoIdentity();
var params = {
    "IdentityPoolName": "samplePool",
    "AllowUnauthenticatedIdentities": true,
    "CognitoIdentityProviders": [
      {
        "ClientId": "xxxxxxxxxxx-qea4ebra0gipd0krefi37v8f48svrp8e.apps.googleusercontent.com", /* google client ID */
        "ProviderName": "accounts.google.com"
      }
    ],
    "DeveloperProviderName": "mypool"
};
cognitoidentity.createIdentityPool(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

but it got an errors below :

{ [ValidationException: 1 validation error detected: Value 'xxxxxxxxxxx-qea4ebra0gipd0krefi37v8f48svrp8e.apps.googleusercontent.com' at 'cognitoIdentityProviders.1.member.clientId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w_]+] message: '1 validation error detected: Value \'xxxxxxxxxxx-qea4ebra0gipd0krefi37v8f48svrp8e.apps.googleusercontent.com\' at \'cognitoIdentityProviders.1.member.clientId\' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w_]+', code: 'ValidationException', time: Tue Jan 31 2017 21:11:48 GMT+1100 (AEDT), requestId: 'ad2b3366-e79d-11e6-b2e7-578f32ddcea5', statusCode: 400, retryable: false, retryDelay: 45.71310137398541 }

Second way, I tried create identity pool id first without CognitoIdentityProviders and then run update using class "UpdateIdentityPool" to add CognitoIdentityProviders (unlock the authentication providers). But, it was same issue above.

Third way, I tried create identity pool id with argumen --cognito-identity-providers from aws cli and still got same issue :

An error occurred (ValidationException) when calling the UpdateIdentityPool operation: 1 validation error detected: Value 'xxxxxxxxxxx-qea4ebra0gipd0krefi37v8f48svrp8e' at 'cognitoIdentityProviders.1.member.clientId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w_]+

Fourth way, I tried create identity pool id without --cognito-identity-providers from aws cli and then update it from aws cli (add --cognito-identity-providers). it was still same issue.

Very frustated with this issue, I have to set it from nodeJS. So, please don't give suggestion to unlock auth providers from AWS Console. There is very poor references for this issue. Really appreciate if you can link me to the solved references.

Thank you

READ ALSO
Angular 2 page not found when refresh

Angular 2 page not found when refresh

I have a problem, i push my project on production with the function enableProdMode() and i have a multiple component and i create my routes

263
MongoDB: show unmatched documents with aggregator and match

MongoDB: show unmatched documents with aggregator and match

I'll try to make it simpleI want to find documents that match my query but also want to list the ones that do not match

294
MongoDB referenceError: Schema is not defined

MongoDB referenceError: Schema is not defined

I've read the questions in this topicBut I wasn't able to find the solution, because I think I defined the Schema well

627