Search code examples
angularamazon-web-servicesaws-amplifyaws-amplify-cli

Moving aws-exports.js to another Angular Project?


If we want to use the same pool in two different Angular applications can we simply copy aws-exports to the other application and configure the Auth category in main.ts or do we have to run amplify init on the project. I know that we need to do the scaffolding steps documented here:

https://medium.com/@ole.ersoy/getting-angular-ready-for-aws-amplify-fc33f07f14a2

I've tried it and it does not work, so it seems like perhaps we have to run amplify init but I wanted to double check if anyone has tried this?


Solution

  • This ended up being a change to the configuration process. Auth has to be configured like this now:

    import Amplify from '@aws-amplify/core'
    import { Auth } from '@aws-amplify/auth'
    import awsconfig from './aws-exports'
    
    Amplify.configure(awsconfig)
    Auth.configure(awsconfig)
    
    

    Whereas before just doing:

    Amplify.configure(awsconfig)
    

    Was enough.