title: Uncaught (in promise): TypeError: Cannot read property 'people' of undefined
body: <p>I'm stuck. I am trying to create a Google People API auth service in Angular.</p>
  
  <p>I am getting an error in the Chrome console:</p>
  
  <pre><code>Uncaught (in promise): TypeError: Cannot read property 'people' of undefined
  </code></pre>
  
  <p>Can someone help me understand why?</p>
  
  <pre><code>declare var gapi: any;
  
  @Injectable({
    providedIn: 'root'
  })
  export class AuthService {
  
    user$: Observable&lt;firebase.User&gt;;
    peopleItems: any[];
  
    constructor(public afAuth: AngularFireAuth) {
      this.initClient();
      this.user$ = afAuth.authState;
    }
  
    initClient() {
      gapi.load('client', () =&gt; {
  
        gapi.client.init({
          apiKey: 'myapikey',
          clientId: '',
          discoveryDocs: ["https://www.googleapis.com/discovery/v1/apis/people/v1/rest"],
          scope: 'https://www.googleapis.com/auth/contacts'
        })
      });
    }
  
    async getPeople() {
      const mypeople = await gapi.client.people.people.connections.list({
        resourceName: 'people/me',
        personFields: 'names,emailAddresses',
      })
      this.peopleItems = mypeople.people.people.list;
    }
  }
  </code></pre>