Reputation: 11
TL;DR How do I provide access for authenticated/unauthenticated users to my movie search API via AWS Cognito without embedding Cognito SDK to the client-side?
AWS Cognito documentation states that you have to deploy client SDK into your application. I want to avoid embedding my API implementation externally to a specific provider. For instance, maybe in the future I will use Google Firebase or any other IdP. Therefore, I don't want to have a deep integration on the client side with Cognito. What is the recommended way to isolate AWS Cognito (or any IdP) from the client-side?
Upvotes: 1
Views: 934
Reputation: 1
One option would be to:
Deploy as an http(s) proxy your API in APIGateway.
Add a APIGateway resource policy to allow operations from an IAM role
Create a Cognito User Pool with authenticated users that assume that IAM role
Add the APIGateway as a resource server to the Cognito User Pool
Allow users to sign in via the aws cli and obtain an access token
Use the access token in calls to the APIGateway endpoint
Upvotes: 0
Reputation: 19758
You can hide the Cognito service behind a backend both for authenticated/unauthenticated users. This comes with several challenges.
Upvotes: 1