facebook - Firebase - getRedirectResult not async with signInWithRedirect.? -


i`m using create-react-app. signinwithredirect response not async getredirect result, reckon because when loginwithfacebook button clicked first time, result null while second time result object required. , after couple of clicks, page redirected not intended.i using in mobile signinwithpopup not used.

handlefacebooklogin = event => {  event.preventdefault();   auth.signinwithredirect(fb).then(result => console.log(result));  auth   .getredirectresult()   .then(result => {     console.log(result);     if (result.credential) {       let accesstoken = result.credential.accesstoken;       let provider = result.credential.providerid;       let email = result.user.email;       console.log(accesstoken, provider, email);       axios({         method: 'post',         url: url,         headers: {           accept: 'application/json',           'content-type': 'application/json'         },         data: {           email,           accesstoken,           provider         }       }).then(response => {         console.log(response);         if (response.status === 200) {           this.props.updatetoken(response.data.token);           this.props.history.push('/page');         }       });     }   })   .catch(error => {     console.log(error.code);     console.log(error.message);     console.log('not working');   }); }; 


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -