MrHertal/react-admin-amplify

Unable to remove resource reactadminamplifydem9cde0abfPreAuthentication

webantz opened this issue · 5 comments

Hi,

I tried to setup and run the demo application and followed the setup instruction as mentioned in the ReadMe.

I am unable to remove resource reactadminamplifydem9cde0abfPreAuthentication.

When I try to run the demo, I land on the login screen, I am not getting redirected to dashboard after logging in.

Note: I created a new user in the Cognito User Pool (Confirmed User)

Hi, you won't be able to login if that preAuth function is here.

In order to remove it, you have to run amplify update auth and go through all the questions (it's a bit tricky).
Here are all the answers:

amplify update auth
Please note that certain attributes may not be overwritten if you choose to use defaults settings.

You have configured resources that might depend on this Cognito resource.  Updating this Cognito resource could have unintended side effects.

Using service: Cognito, provided by: awscloudformation
 What do you want to do? Walkthrough all the auth configurations
 Select the authentication/authorization services that you want to use: User Sign-Up, Sign-In, connected with AWS IAM controls (Enables per-user Storage features for images or other c
ontent, Analytics, and more)
 Allow unauthenticated logins? (Provides scoped down permissions that you can control via AWS IAM) Yes
 Do you want to enable 3rd party authentication providers in your identity pool? No
 Do you want to add User Pool Groups? No
 Do you want to add an admin queries API? No
 Multifactor authentication (MFA) user login options: OFF
 Email based user registration/forgot password: Enabled (Requires per-user email entry at registration)
 Please specify an email verification subject: Your verification code
 Please specify an email verification message: Your verification code is {####}
 Do you want to override the default password policy for this User Pool? No
 Specify the app's refresh token expiration period (in days): 30
 Do you want to specify the user attributes this app can read and write? No
 Do you want to enable any of the following capabilities?
 Do you want to use an OAuth flow? No
? Do you want to configure Lambda Triggers for Cognito? Yes
? Which triggers do you want to enable for Cognito
Removing resource reactadminamplifydem9cde0abfPreAuthentication...
Successfully removed resource

Then you have to push changes: amplify push

Do you get any error while following this process?
if so, please paste the answers you give like above + the error message.

In the last step, For Which triggers do you want to enable for Cognito ? By Default Pre Authentication is selected.

Which triggers do you want to enable for Cognito (Press to select, to toggle all, to invert selection)
◯ Define Auth Challenge
◯ Post Authentication
◯ Post Confirmation
❯◉ Pre Authentication
◯ Pre Sign-up
◯ Verify Auth Challenge Response
◯ Pre Token Generation

is this correct?

I tried unchecking Pre Authentication but it updates the resources and not removing them as you mentioned

? Which triggers do you want to enable for Cognito
Successfully updated the Lambda function locally
Successfully updated auth resource reactadminamplifydem9cde0abf locally

You have to press space to unselect Pre Authentication then press enter.

If you only press enter it does not update!

I also made that mistake when I was beginning with the Amplify CLI :)

OK - Update

tried in Windows OS it worked

In MacOS its not removing, will try updating amplify cli

OK @webantz

I will reopen this issue if you still have the problem.