I am using nuxt to generate a static website (nuxt generate
) and added nuxt-auth
for authenticate the app vs. AWS Cognito.
The hosting of this site is via S§ + Cloudfront.
I am also deploying an API to AWS using Lambda functions. These functions are deployed with AWS CDK and I can easly add some ENV variables for the Cognito PoolId and Client ID.
In the nuxt.config.ts
I configured an oauth2
scheme for my cognito-user-pool and everything is working as expected.
As I want to run this web-app in two different stages (test+production) I have the problem, that I have to build the Web-app explicitly with the different ENV values for each stage (as the poolId, clientId and API URL) is different for each stage.
Now I had the idea to create a route in the API providing stage specific information like clientId and poolId and I have only add the Api URL to my build instead of multiple variables. The problem is, that the strategies are created within the nuxt-config and I found nothing to add a strategy later after I fetched the required information (nuxt-auth-api).
Is there a way to do this? Or is there another way to deploy the static web-app without handling several variables for each stage build? I am not so keen to manage the poolId, client Id and some other AWS IDs manually.