0

I have an application using Spring Boot on the backend and Angular on the frontend. Now I have implemented a login screen via Amplify AWS in the frontend that accesses the Cognito user pool to authenticate my users. These have the roles of user and admin.

My goal now is to allow a manually created admin to add users via the frontend interface, which will then land directly in my Cognito user pool. Currently I have found a few approaches (AWS JS SDK, Lambda, AWS.CognitoIdentityServiceProvider API, amplify), but none straightforward that could solve my problem, as amplify doesn't seem to offer an option for creating users. How would you guys proceed to solve this problem as straightforward as possible? What are my next steps to achieve a programmatic solution for user creation via Angular frontend?

Thanks in advance.

tgtrmr
  • 159
  • 9

1 Answers1

1

This can be accomplished with the Cognito IDP APIs AdminCreateUser action it requires AWS credentials so it will either need to be implemented in the backend or you will need to get credentials for your user using cognito identity pool in the frontend.

Andrew Gillis
  • 3,250
  • 2
  • 13
  • 15
  • 1
    Why would you need Cognito Identity Pools? Isn't Identity Pools only for Authorization? Although you are right about the API call. – Arka Mukherjee May 17 '21 at 13:33
  • 1
    You need identity pool because you need AWS credentials to sign your API call. You can fetch those AWS credentials with a user pool id token using identity pool. – Andrew Gillis May 17 '21 at 13:35
  • 1
    @ArkaMukherjee This is the flow https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-scenarios.html#scenario-aws-and-user-pool – Andrew Gillis May 17 '21 at 13:49
  • @AndrewGillis How do I implement the cognito identity pool in the frontend? When I search for approaches for Angular, I am also only referred to amplify? – tgtrmr May 17 '21 at 14:16
  • 1
    The [cognito identity SDK](https://www.npmjs.com/package/amazon-cognito-identity-js) is maintained by the amplify team but can be used separate from it. They have useful examples on the linked page. – Andrew Gillis May 17 '21 at 14:21