feat: sign in with microsoft

This commit is contained in:
liyasthomas
2022-03-03 09:06:35 +05:30
parent 484fcd7365
commit b7988b54c5
38 changed files with 139 additions and 23 deletions

View File

@@ -6,6 +6,7 @@ import {
signInWithPopup,
GoogleAuthProvider,
GithubAuthProvider,
OAuthProvider,
signInWithEmailAndPassword as signInWithEmailAndPass,
isSignInWithEmailLink as isSignInWithEmailLinkFB,
fetchSignInMethodsForEmail,
@@ -203,6 +204,13 @@ export async function signInUserWithGithub() {
)
}
/**
* Sign user in with a popup using Microsoft
*/
export async function signInUserWithMicrosoft() {
return await signInWithPopup(getAuth(), new OAuthProvider("microsoft.com"))
}
/**
* Sign user in with email and password
*/
@@ -363,6 +371,9 @@ async function reauthenticateUser() {
} else if (currentAuthMethod === "github.com") {
const result = await signInUserWithGoogle()
credential = GoogleAuthProvider.credentialFromResult(result)
} else if (currentAuthMethod === "microsoft.com") {
const result = await signInUserWithMicrosoft()
credential = OAuthProvider.credentialFromResult(result)
} else if (currentAuthMethod === "password") {
const email = prompt(
"Reauthenticate your account using your current email:"