ค้นหาเว็บไซต์

typescript - ดึงข้อมูลผู้ใช้จาก NbAuthOAuth2Token ใน Angular


ฉันกำลังใช้ NbAuthOAuth2Token แบบนี้

this.authService.onTokenChange()
  .pipe(takeUntil(this.destroy$))
  .subscribe((token: NbAuthOAuth2Token) => {
    this.token = null;
    if (token && token.isValid()) {
      this.token = token;
    }
  });

และในฟังก์ชันการเข้าสู่ระบบของฉันแบบนี้

  login() {
    this.authService.authenticate('google')
      .pipe(takeUntil(this.destroy$))
      .subscribe((authResult: NbAuthResult) => {
      });
  }

จะดึงข้อมูลผู้ใช้อย่างไร? ฉันกำลังใช้ scope: 'https://www.googleapis.com/auth/userinfo.profile'