I'm trying to build a basic chatbot from a webpage to AWS lex. I am trying to follow this page: https://aws.amazon.com/blogs/ai/greetings-visitor-engage-your-web-users-with-amazon-lex/
Obviously, there is stuff that I have not setup properly, but I don't know enough to identify what it is.
I have a web page hosted in an S3 bucket. I can get to that web page, I can enter a question on it, and then I get an error: POST https://cognito-identity.us-east-1.amazonaws.com/ 400 (Bad Request)
// Initialize the Amazon Cognito credentials provider
AWS.config.region = 'us-east-1'; // Region
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
// Provide your Pool Id here
IdentityPoolId: 'us-east-1_XXXXXXXX', // IdentityPoolId: 'us-east-1:12345678-abcd-1234-aaaa-123456789'
});
var lexruntime = new AWS.LexRuntime();
var lexUserId = 'discoveryUser' + Date.now();
var sessionAttributes = {};
var p = AWS.config.credentials;
for (var key in p) {
if (p.hasOwnProperty(key)) {
console.log(key + " -> " + p[key]);
}
}
Error: Missing credentials in config
expired -> true
chat.html:81 expireTime -> null
chat.html:81 accessKeyId -> undefined
chat.html:81 sessionToken -> undefined
chat.html:81 params -> [object Object]
chat.html:81 data -> null
chat.html:81 _identityId -> null
chat.html:81 _clientConfig -> [object Object]
chat.html:84 credentials: true,,,,[object Object],,,[object Object]
I would be satisfied if unauthorized users could access this page. There is nothing private on it. Alternatively, it is not clear to me how to authenticate from my front page. Do I need to supply a form? If I need to make a login page, are there any examples that show how to send the data to cognito? Have I failed to set the users and groups properly?
Please point me in the right direction. Thanks.