1

To be more specific, I have a react app, which contains 3 input fields (maintained using useState() Hooks.

<input type="text" name="username" value={state.username} onInput={} />
<input type="password" name="password" value={state.password} onInput={} />
<input type="text" name="channel name" value={state.channel} onInput={} />

this field needs to take take "username and password " (ACCOUNT in the AWS user pool.)

here, "channel name" is used for another service in AWS after getting authenticated.

the task is =>

I need to use AWS cognito identity pool for authentication (using username and password from the input field) once authenticated, an access key and secret key are needed for other service configurations.

Flow:

step 1 ::: 
username + password ----> auth using identity pool --> get accesskey and secrete key

step 2 ::: (already have code . need to know how step 1 is done ? )
accesskey + secrete key + channel name  ---> aws kinesis

I am new to AWS . please share some insight on how it should be done. really appreciate it if shared some code and related docs

LamriN
  • 11
  • 4

1 Answers1

1

This is a multi step process. I'll list the API calls you need to make to get from username and password to temporary aws credentials.

  1. InitiateAuth - This will exchange your credentials for tokens.
  2. GetId - This will fetch the identity id for the user. You need to pass id token you got from previous step.
  3. GetCredentialsForIdentity - This will get you the final temporary AWS credentials that you can use to authenticate calls to other aws services. Pass the Identity Id from previous step. Login will be same as previous step.

You will get access key, secret key and session token at the end of step 3. You need to use all three to authenticate other services.

Ninad Gaikwad
  • 4,272
  • 2
  • 13
  • 23