Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

This operation is not supported in the environment this application is running on. "location.protocol" must be http or https

Using Firebase and React Native to authenticate users into my app.

One thing I have noticed is when trying to use facebook login however I am thrown this error:

This operation is not supported in the environment this application is running on. "location.protocol" must be http or https.

Not really sure how to solve it honestly

like image 395
Joe Caraccio Avatar asked Dec 19 '22 15:12

Joe Caraccio


1 Answers

You must be using signInWithPopup/Redirect. This is only currently supported in a browser environment. You will need to use some native library (facebook/google) to retrieve the corresponding OAuth access token. Once you get that, you can call signInWithCredential to sign in the Firebase user:

firebase.auth().signInWithCredential(firebase.auth.FacebookAuthProvider.credential(fbAccessToken))
like image 63
bojeil Avatar answered Dec 28 '22 08:12

bojeil