0

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?

Ole
  • 41,793
  • 59
  • 191
  • 359

1 Answers1

0

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.

Ole
  • 41,793
  • 59
  • 191
  • 359
  • 1
    May I ask the difference between `import Amplify , { Auth } from 'aws-amplify';` and what you listed. I feel like the last few months I've drifted a little and I don't know if I should be using @aws-amplify vs aws-amplify? – Mark Sep 29 '20 at 19:14
  • In my last Angular 10 project which is https://fireflysemantics.com/ I'm using `import Auth from '@aws-amplify/auth';` – Ole Sep 29 '20 at 21:16
  • 1
    Thanks I double checked package sizes after build, and didn't see any major diff. I got worried as my 'import cost' plugin in VSCode was telling me it was adding some heft with the @aws-amplify references. – Mark Sep 30 '20 at 22:03