I have a custom domain purchased with Route 53. My Amplify app has hosting configured to use it in production.
I can successfully login to my application from the backend https://prod.appID.amplifyapp.com/ domain.
However, when I login attempt to login to https://myCustomDomain.org/ the Amplify Hub listener events never fire.
My app is configured like soo.
App.tsx snippet:
Amplify.configure(updatedAwsConfig); //aws.exports is updated to correctly set oath.redirectSignIn and oauth.redirectSignOut (per AWS docs)
console.log(`Setting Updated Oauth: ${JSON.stringify(updatedAwsConfig.oauth)}`);
Hub.listen('auth', authEventsProcessor);
function App()
{
//main app page is defined here.
authEventsProcessor definition
export const authEventsProcessor = (data: any) : HubCallback | LegacyCallback => {
//any => {
console.log(`Processing Auth Event:\n${JSON.stringify(data)}`);
//console.log(`Processing Auth Event(2):\n ${data}`);
switch (data.payload.event) {
case 'signIn':
case 'cognitoHostedUI':
console.log('signing in user');
handleSignInEvent(data.payload.data);
break;
case 'signOut':
handleSignOut();
console.log('user signed out');
break;
/*
case 'signUp':
console.log('user signed up');
break;
case 'signIn_failure':
case 'cognitoHostedUI_failure':
console.log('user sign in failed');
break;
case 'configured':
console.log('the Auth module is configured');
*/
}
return data;
};
pakage.json dependency snippet
"@aws-amplify/core": "^5.8.6",
"@aws-amplify/ui-react": "^5.3.2",
"@aws-amplify/ui-react-storage": "^2.3.2",
"aws-amplify": "^5.3.13",
"react": "^18.2.0",
"react-app-polyfill": "^3.0.0",
"react-dom": "^18.2.0",
"react-redux": "^8.0.4",
"react-router-dom": "^6.4.1",
"react-scripts": "5.0.1",
"redux-saga": "^1.2.1",
"tss-react": "^4.3.2",
"typescript": "^4.8.4",
When I look in my Browser console I never see the 'Processing Auth Event:' line for my custom domain like I do for the amplifyApp.com domain.
What's going on? Is this a bug in Amplify?
How do I check that?
Thank you. Your "answer" turned out to be the tip I needed to figure it out.
Turned out I had a problem in my configuration. My app is setup to serve from https://www.my-custom-domain.org/ but my Authentication was configured with https://my-custom-domain.org/ so it didn't have the www. part of the URL my browser was visiting. Updating my config w/ the www fixed it.