Lambda execution is submitted.
If you are authenticated, the lambda will execute and you will see a pop-up on this page that says 'Lambda execution successful'.
If you are unauthenticated, you'll see a pop-up with a messaging stating you are not authorized.
Click on the 'Execute Lambda' button below.
If you are authenticated, the lambda will execute and you will see a pop-up on this page that says 'Lambda execution successful'.
If you are unauthenticated, you'll see a pop-up with 'You are not authorized to execute the function'
);
}
},[Continue]);
useEffect(() => {
if(Signin)
{
window.location.assign(process.env.REACT_APP_COGNITO_HOSTED_UI_URL);
}
/*{
var requestOptionsFurl = {
method: 'GET'
};
fetch('https://q6nnei6gt5epmgmewi5x5zu4rq0ernmr.lambda-url.us-east-1.on.aws/', requestOptionsFurl)
.then(response => response.json())
.then(data => {
if (data.message.indexOf("Error") === -1 )
{
window.location.assign(data.message)
}
else{
alert(data.message);
}
})
;
setSignin(false);
}*/
},[Signin]);
useEffect(() => {
//everytime the page loads, determine if the ?code= url string is present. This url parameter is set by cognito hosted ui.
//If present, set this code as cookie with name code. We'll send this cookie value to lambda to determine
// if the user is authorized to execut the business logic in the lambda hence mimicing the Cognito Authorization in API gateway
var url = window.location.search;
if(url.indexOf("code=") !== -1 ) //meaning the url string has the code, it is returned from cognito hosted ui after successful authentication. Now save the code as cookie and show the "execute lambda page"
{
document.cookie="code="+ url.substring(6,url.length);
setBody(
AWS
Welcome to aws ComputeBlog
Click on the 'Execute Lambda' button below.
If you are authenticated, the lambda will execute and you will see a pop-up on this page that says 'Lambda execution successful'.
If you are unauthenticated, you'll see a pop-up with 'You are not authorized to execute the function'
);
}
else {
document.cookie="code=''";
fetch()
//Everytime page loads, set the body of the page as the page that shows the login and contineu buttons
setBody(