Commit 44fcd80a authored by Milan John Paul Digiuseppe's avatar Milan John Paul Digiuseppe

Merge branch 'Will-Fix-FB-Login' into 'master'

fix facebook login

See merge request !12
parents 56f0edc0 6bb12c11
......@@ -123,30 +123,20 @@ const persistToken = async (token: string) => {
export const signInAsyncFacebook = () => async (dispatch: Dispatch) => {
// TODO: get token from signing in via third-party auth
try {
const token = await FacebookLogIn();
const token = await FacebookLogIn().catch((error) => {
console.warn(`Facebook Login error : ${error}`);
return;
});
const credential = Firebase.auth.FacebookAuthProvider.credential(token);
let userCredential = await Firebase.auth().signInWithCredential(credential).catch((error) => {
console.warn(`Firebase auth error : ${error}`);
return;
});
} catch (exception) {
return;
}
// do firebase login
const credential = Firebase.auth.FacebookAuthProvider.credential(token);
//await Firebase.auth().setPersistence(Firebase.auth.Auth.Persistence.LOCAL);
let userCredential = await Firebase.auth().signInWithCredential(credential).catch((error) => {
console.warn(`Firebase auth error : ${error}`);
return;
});
let user = userCredential.user;
// --- state change done by auth change listener
let userInfo = { token: user.refreshToken,
name: user.displayName,
// idToken: user.getIdToken(),
id: user.email,
imageUrl: user.photoURL
};
//dispatch(restoreToken(userInfo));
};
export const signInAsyncGoogle = () => async (dispatch: Dispatch) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment