How to use aws go sdk for authentication and authorization using cognito

459 views Asked by At

Currently I am working with aws-sdk-go to implementing authentication and authorization using aws cognito.

  1. In aws-sdk-go there are two functions available one is cognitoidentityprovider another one is cognitoidentity. Which one to use.
  2. Within cognitoidentityprovider function there is an option to create user pool. but cognitoidentity function not providing function to create user pool. What is the reason for CreateUserPoolClient and CreateUserPool function ? actually IaC tools like terraform or cloudformations are providing the resources to provision user pool. Correct me if I am wrong. I dont think javascript sdk allows to create user pool. If aws-sdk-go allows to create user pool is it working like aws cdk with golang.
  3. which one to choose between aws-sdk-go or aws-sdk-go-v2

more info: https://docs.aws.amazon.com/sdk-for-go/api/service/cognitoidentityprovider/

1

There are 1 answers

0
Gernot Glawe On
  • You should absolutely use v2
  • All api calls are supported by js sdk and GO sdk. GO V2 and js V3 are generated from the api schemata
  • There are function to admin pools and identities and functions to authenticate
  • An app client is the id for an application to talk to cognito
  • cognito can be confusing
  • Try to use the js example on https://docs.aws.amazon.com/cognito/latest/developerguide/authentication.html and use these in go

Hope that helps. A complete example is a work from several hours so I am just can give hints.