JS file config is
import {initializeApp} from 'firebase/app';
import {getAuth, signInWithPopup, GoogleAuthProvider } from "firebase/auth";
const firebaseConfig = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: ""
};
initializeApp(firebaseConfig);
export async function postLogin (req, res, next) {
const provider = new GoogleAuthProvider();
const auth = getAuth();
signInWithPopup(auth, provider)
.then((res)=>{
console.log(res);
})
.catch((err)=>console.log('ERROR : ' + err));
}
And a pug file with a button triggers the "postLogin" function. The result is error Firebase: Error (auth/operation-not-supported-in-this-environment)
I read lots of documents and blogs, unfortunately not solve the case. Many documents are react based. But I don't use react. Is that any solution? Regards
Did you follow steps at https://firebase.google.com/docs/auth/web/google-signin
Before you begin Add Firebase to your JavaScript project. Enable Google as a sign-in method in the Firebase console: In the Firebase console, open the Auth section. On the Sign in method tab, enable the Google sign-in method and click Save.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.