I have cognito user pool defined. When I run my app, it shows a custom login page (not hostedUI page), when I enter username and password, I want to get a code after clicking on signin
button.
Using Cognito HostedUI page, when I enter username and password and click on signin
button, it sends a code back (can be seen in browser’s URL). I want to implement the same in my custom login page.
-
is it possible ?
-
If yes, how can I get a code when I enter username and password in my custom login page after clicking the
signin
button ?
I was just reading about authorization endpoint and tried below thing. I don’t know if it is right
When signin button is clicked I make a GET call as below,
const requestOptions = {
method: "GET",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
}
};
fetch(`https://${process.env.domain}/oauth2/authorize?
response_type=${process.env.responseType}&
client_id=${process.env.appClientId}&
redirect_uri=${process.env.redirectSignIn}&
scope=openid+profile+aws.cognito.signin.user.admin`, requestOptions);
but it doesn’t do anything.
- Also, How and where to use entered username and password in above URL or anywhere else?
FYI I do have SSO login functionality and I’m able to get a code for SAML (Azure-ad) login but for cognito username and password I don’t know how to get it.