companydotcom / vastly

https://dxp-workshop.vercel.app
3 stars 0 forks source link

ATX-2622 | Refactors shared authorizer to check for stage variable #211

Closed jacobgranberry closed 1 year ago

jacobgranberry commented 1 year ago

The authorizer currently checks for the Authorization token from the request, validates it, and if its valid, we then grab the users organization from Cognito, the users assigned accounts from the Dynamo User table, and cross checks the passed query parameter called stage. If the stage param exists on the users accounts, add the id to the response context, and proceed

Query params are sent from the frontend like this:

await client.fetch(`${client.apiUrl}/user?stage=STAGE_NAME

after its passed through the authorizer, you can access it from the lambda function like this:

const getUser = async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
const accountId =  event.requestContext.authorizer?.['targetAccountId']);
....
vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
vastly-forms ✅ Ready (Inspect) Visit Preview Oct 13, 2023 6:11pm
wave-website ✅ Ready (Inspect) Visit Preview Oct 13, 2023 6:11pm
2 Ignored Deployments | Name | Status | Preview | Updated (UTC) | | :--- | :----- | :------ | :------ | | **vastly-ui** | ⬜️ Ignored ([Inspect](https://vercel.com/companycom/vastly-ui/7dqPVTm98s4LWbcZPP6eqoYBdgyK)) | | Oct 13, 2023 6:11pm | | **workshop** | ⬜️ Ignored ([Inspect](https://vercel.com/companycom/workshop/9dcwHxEeQfZtdwv7vRpk2Nb95tcu)) | | Oct 13, 2023 6:11pm |
vercel[bot] commented 1 year ago

Deployment failed with the following error:

There is no GitHub account connected to this Vercel account.