I am trying to build a single portal app that will allow end users to access multiple apps/resources in AWS - that might be a dash app running in a fargate task or simply a button that triggers a state machine (for example).
I am using React, AWS Amplify (for the single page entry), Cognito, API Gateway (HTTP), Axios Interceptors.
Here is how my interceptor is configured:
const interceptor = aws4Interceptor(
{
region: "eu-west-1",
service: "execute-api",
},
{
accessKeyId: accessKeyId,
secretAccessKey: secretAccessKey,
sessionToken: sessionToken
})
axios.interceptors.request.use(interceptor);
And here is my axios.get:
axios.get( 'https://abcdefg.execute-api.eu-west-1.amazonaws.com/myapi/')
.then( response => {
console.log(response.data);
console.log(response.request.responseURL);
})
.catch((err) => {
console.log(err);
});
While this will work, and I will be able to see the content in the console - let's assume that this route has a lambda integration that prints something - this is not really what I am aiming for.
What I really want (and let's assume that the API Gateway route has an integration with a dash app running in fargate), I would like to open such web application in the current/new tab.
So, I am not really just to pull some data from a database or something, but really I want to be able to open a web app if needed.
Q: Is this even possible to make?
Currently:
- using Postman, the request (using AWS Signature) will be successful
- same applies with the case above, but I cannot find a way to open the route integration as a single app - I can only print it's content
When doing axios.get it is possible to see all the required headers in the request: authorization, x-amz-date, x-amz-security-token, but then we would need some kind of "redirect" to actually open the web app - and here is where we have problems since the new request won't have such headers so we will get 401 Unauthorized errors.
Is there a way to go around this? Authentication cookies? URL token?
Thank you