5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

AngularFire 6とAngular 9では、AngularFireAuthが少し変わったよ!

Last updated at Posted at 2020-05-24

#はじめに
Angularを使ってる人たちにはお馴染みのAngularFire

こいつがAngular 9にアップグレードされたのに合わせて、最新バージョンがAngularFire 6となりました(2020年5月現在)

それによって変わった点を1つ紹介(たくさんあると思うので、詳しくはこちらを見てね:thumbsup:

#よく使うであろうAngularFireAuthが変わった
Before Version 6

export class UserService {

  constructor(public afAuth: AngularFireAuth) {}

  signIn(): Promise<auth.UserCredential> {
    return this.afAuth.auth.signInWithPopup(new auth.GoogleAuthProvider());
  }
  signout(): Promise<void> {
    return this.afAuth.auth.signOut();
  }
}

In Version 6
this.afAuth.signInWithPopupのように、authが無くなった!!

export class UserService {

  constructor(public afAuth: AngularFireAuth) {}

  signIn(): Promise<auth.UserCredential> {
    return this.afAuth.signInWithPopup(new auth.GoogleAuthProvider());
  }
  signout(): Promise<void> {
    return this.afAuth.signOut();
  }
}

currentUserも同じように変わったようです。

Before Version 6

sendEmailVerificationLink(): Promise<void> {
    return this.afAuth.auth.currentUser.sendEmailVerification();
  }
}

In Version 6

sendEmailVerificationLink(): Promise<void> {
    return this.afAuth.currentUser.then((user) => {
      return user.sendEmailVerification();
    });
  }
5
2
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?