-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(auth): enable multiple social providers (#25)
- Loading branch information
1 parent
63e4180
commit ecb462a
Showing
5 changed files
with
130 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { User } from "./user"; | ||
|
||
export interface UserCredentialOptions { | ||
isNewUser: boolean; | ||
} | ||
|
||
export class UserCredential implements firebase.auth.UserCredential { | ||
readonly additionalUserInfo: firebase.auth.AdditionalUserInfo | null = null; | ||
readonly credential = null; | ||
|
||
constructor( | ||
readonly user: User, | ||
readonly operationType: "signIn" | "link" | "reauthenticate", | ||
{ isNewUser }: UserCredentialOptions | ||
) { | ||
if (!user.isAnonymous) { | ||
this.additionalUserInfo = { | ||
isNewUser, | ||
profile: null, | ||
// providerId should be at the right value in the user object already. | ||
providerId: user.providerId, | ||
username: user.email, | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters