johnf/serverless-cognito-demo

Clarify how to authorise and use API

kaihendry opened this issue · 4 comments

Are you basically saying that your user needs to be in the pool to invoke it? Or can you show a curl that shows it successfully works once authorised?

johnf commented

@kaihendry Sorry what do you mean?

I only created this repo as a demo for my patch to serverless

I'm trying to understand the demo. I think the idea is to use this to protect an API by authorising usage by users in a pool. Is that correct?

https://github.com/johnf/serverless-cognito-demo/blob/master/serverless.yml

So once that's been done, I am puzzled to actually then use the API and authorise against it, using curl or a browser.

Cotel commented

Have you developed some example since then @kaihendry ? Im going through the same doubts 🤔

johnf commented

Hi,

Apologies I didn't get to this the first time around. To authorise this you need to authenticate the user using the cognito SDK. Details are at

https://github.com/aws/amazon-cognito-identity-js