max.suster
09/12/2021, 12:31 PMauth.addPermissionsToAuthRole
. I assume this might have been asked before, but I can not find a clear and defintive answer in the context of SST.
Essentially, I have already deployed an Auth sst stack with Cognito User Pools and its working fine for my ReactStaticApp. However, now I have a separate Infrastructure repository in which I created an Api sst stack, but I am struggling to use the same Cognito User pools already deployed for the React app. I have been trying to add IAM authentication (from the already existing User pool) to the Api SST stack by doing something very similar to a solution reported in a previous thread (adding a Policy to an IAM role). My solution gets deployed ok, but does not seem to work (I get HTTP 403 when using my existing Cognito User credentials). I assume this might not work without being able to refer to an instance of the original Auth stack?
Does anyone have a suggestion for reusing an existing Auth/Cognito pools for an Api sst that is deployed in a separate repository? Thanks in advance.Frank
const api = `sst.Api(this, "Api", {
httpApi: apigv2.HttpApi.fromHttpApiAttributes(this, "ImportedApi", { httpApiId });
});
auth.addPermissionsToAuthRole([api]);
max.suster
09/12/2021, 4:01 PMFrank
Frank
max.suster
09/12/2021, 8:42 PMmax.suster
09/12/2021, 8:44 PMmax.suster
09/12/2021, 8:50 PMFrank
max.suster
09/13/2021, 1:16 AM{message: 'Forbidden'}
Error 403 only when I attempt to call the API via the React app using Amplify Auth. In other words, I can successfully invoke all the API enspoints via npx aws-gateway-cli-test and create/get/update DynamoDB entries in my Orders table. Cognito authentication continues to work fine for the signup/sigin in React. I realize there could be many reasons for this error, but I previously tested a simple API from the SST examples in my app, and this never happened. Do you have any pointers as to the likely reasons for getting Message Forbidden in this context? Thanks so much for your kind help.Frank
aws-gateway-cli-test
, that means the backend (Auth and Api) is hooked up correctlyFrank
Frank
aws-gateway-cli-test