Web Google authentication with firebase
uncaught exception: Error: This operation is not supported in the environment this application is running on. "location.protocol" must be HTTP, HTTPS or chrome-extension and web storage must be enabled.
Recently even i faced the same error.
You are opening this file directly in the browser without any web server. Firebase authentication won't work if you open the file directly. Try to load your HTML through web server it should solve your issue. The reason behind this bug is when you use authentication services they will use web storage. web storage does not work when you open an HTML file directly without any web browser
For example, use apache and open through apache like http://localhost/filename.html in the browser
Related videos on Youtube
ArunKarthick
Updated on June 19, 2022Comments
-
ArunKarthick about 2 years
uncaught exception: Error: This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.
var config = { apiKey: "*****", authDomain: "******", }; firebase.initializeApp(config); var provider = new firebase.auth.GoogleAuthProvider(); provider.addScope('profile'); provider.addScope('https://www.googleapis.com/auth/drive'); firebase.auth().signInWithRedirect(provider); alert(1); }
-
jeffbyrnes about 7 yearsWhat’s your actual question here?
-
-
ArunKarthick about 7 yearsthanks for ur reply. yeah that is true.i use that code in adobe cep extension it does not have any web browser. so is it possible to run that code without web server or web browser
-
ArunKarthick about 7 yearsthank for ur reply. sorry that code not solved my problem
-
Dinesh undefined about 7 yearssorry no idea.@ArunKarthick
-
ArunKarthick about 7 yearsis it possible with nodejs
-
Dinesh undefined about 7 yearsyes its possible. just create expressjs server and add your file there
-
ArunKarthick about 7 yearsI am new in node. can you pls give any example with express js.
-
Dinesh undefined about 7 yearsfollow this tutorial mfranc.com/node-js/node-js-simple-web-server-with-express
-
ArunKarthick about 7 yearssorry i can't understand that. that code includes port so app.listen(port) also worked in localhost!
-
Dinesh undefined about 7 yearsdid you create server with port. if so open it using localhost:port
-
ArunKarthick about 7 yearsis it possible to create server without port. my project must run without localhost
-
Dinesh undefined about 7 yearswithout port we cant create ant server. by default http runs on port 80. if you want to run without port means run nodejs on port 80 with root permission
-
Mahmoud Niypoo over 5 years@Dineshundefined i have used it with the nodejs server and call route by browser and bu another server (angular) and always got this error !!
-
jolly about 4 yearsThis is not a solution. The problem still persists in iOS for Firebase auth by Google
-
kdpnz over 2 yearsThis would rely on adding Github as an authorised domain for accessing your Firebase project. In turn, this would allow any Github-hosted page access to your project.