Search code examples
iosauthenticationhttp-redirectaws-amplify-cliaws-amplify

AWS amplify add auth: how to add a redirect signin URI after executing the amplify cli


Context: I was following a AWS tutorial to create iOS application using Amplify. One of the steps was to use 'amplify add auth' and specify the 'redirect signing URI'. For some reason the CLI didn't prompt me for the URL. 'amplify update auth' does not provide an option to specify the redirect URL.

Question: How can I add redirect URL to the project, after executing the 'amplify add auth' command?


Solution

  • I don't know what problem you are having, but you can use

    amplify update auth
    

    If you try:

    amplify add auth
    

    It will give you an error:

    Auth has already been added to this project. To update run amplify update auth.

    Use amplify update auth, you will be asked for the URI.

    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? (Use arrow keys)
     What do you want to do? Apply default configuration with Social Provider (Federation)
     What domain name prefix do you want to use? myprojd2553e50-d2553e50
     Enter your redirect signin URI: myapp://callback/
    ? Do you want to add another redirect signin URI No
     Enter your redirect signout URI: myapp://signout/
    ? Do you want to add another redirect signout URI No
     Select the identity providers you want to configure for your user pool: (Press <space> to select, <a> to toggle all, <i> to invert selection)
    >( ) Facebook
     ( ) Google
     ( ) Login With Amazon
    

    If you need to start over, try:

    amplify init
    amplify pull auth
    amplify remove auth
    amplify add auth