firebase.auth().signInWithPopup() not works with Chrome extension on Linux/Mac

I am developing a chrome extension.I have used firebase google sign for authentication using firebase.auth().signInWithPopup() method.

It works well with Windows.But it do not works with Linux/Mac OS. A popup window appears for a while then it disappears.
Please suggest Solution.

Firebase Phone Number authentication in Chrome Extension

Is it possible?
I read a bit on https://firebase.google.com/docs/auth/web/phone-auth but it mentions OAuth redirect domains all the time, not sure if chrome extension domains are valid for this?

Firebase re-authenitcate user. How to get correct token?

I’m working on chrome extension (provides main functionality) and the complementary website (mostly profile and billing related functionality) both backed with firebase backend.

I’m wondering if it’s possible to implement the below scenario:

  • user logs in with the extension using firebase authentication (with firebaseUI lib)
  • I store a token that I can use to reauthenticate that user (is there such a token?)
  • when user opens the website, I login that user automatically with the token.

While both the extension and the website has their login/signup forms I’m wondering if it’s possible to login user in the extension and to somehow automatically login that same user on the website so they don’t have to enter their credentials twice?

So far I was hoping that I could use something like below:

firebase.auth().currentUser.getIdToken(true).then(function(idToken) {
            console.log("idToken = ", idToken)
})

And then to use that idToken like this, since if I understand correctly, it’s an AWT:

firebase.auth().signInWithCustomToken(idToken).catch(function(error) {
    // Handle Errors here.
     var errorCode = error.code;
     var errorMessage = error.message;
     console.log("signInWithCustomToken: error = ", error)
 })

But it gives the following error:

code: "auth/invalid-custom-token"
message: "The custom token format is incorrect. Please check the documentation."

I can parse the token on https://jwt.io/ which shows all the user information but in the end it says “invalid signature”

So I guess this token can be only used to check authentication (like admin.auth().verifyIdToken(idToken)) but not to login user. Am I right?

I know I can create a custom token, but is there any straightforward way to workaround that and to login user from one place only using firebase funstionality? (of course without storing username/password)

Firebase UI in Chrome extension: signInSuccess never called

It drives me mad, so posting it here after 3 wasted days of applying “drop-in” auth solution. Hopefully, anyone can shed any light on what I’m missing.

Basically I’ve setup faribes app in the dashboard and successfully inited farebase in my chrome extension. When I drop firebasUI for email/password authentication, it seems to work fine – it successfully checks if email exists or not and shows the respective flow. For signup, it creates a user in firebase database once the flow is completed.

The problem is that signInSuccess is never called neither in signin nor in signup flow.
Moreover firebase.auth().onAuthStateChanged(...) always returns null user

If I use plain signInWithEmailAndPassword() / createUserWithEmailAndPassword() everything works fine and onAuthStateChanged() returns the correct user.

Below is the code I’m using in the chrome extension:

credentials.js (popup script):

//init firebase
var config = {
    apiKey: "",
    authDomain: "",
    databaseURL: "",
    projectId: "",
    storageBucket: "",
    messagingSenderId: ""
};
firebase.initializeApp(config);


//ui config for firebaseUI
var uiConfig = {
    signInSuccessUrl: 'http://google.com',
    credentialHelper: firebaseui.auth.CredentialHelper.NONE,
    callbacks: {
        signInSuccess: function(currentUser, credential, redirectUrl) {
            console.log('sign in success');
            console.log(currentUser);
            // alert(currentUser)
            return false;
        },
        uiShown: function () {
            console.log("uiShow");
        }
    },
    signInFlow: 'popup',
    signInOptions: [{
        provider: firebase.auth.EmailAuthProvider.PROVIDER_ID,
        requireDisplayName: false
    }]
};

//launch the firebaseUI flow
var ui = new firebaseui.auth.AuthUI(firebase.auth());
ui.start('#firebaseui-auth-container', uiConfig);

credentials.html (popup html):




  
  Sample FirebaseUI App
  
  
  
  




Welcome to My Awesome App

manifest:

{
  "manifest_version": 2,
  "name": "Some Name",
  "description": "Some description",
  "version": "0.1",
  "icons": {
    "128": "icon.png"
  },
  "browser_action": {
    "default_icon": "icon.png",
    "default_popup": "credentials.html"
  },
  "background": {
    "page": "background.html"
  },
  "permissions": [
    "identity",
    "https://*/*",
    "activeTab",
    "background"
  ],

  "content_security_policy":"script-src 'self' https://www.gstatic.com https://apis.google.com https://www.googleapis.com https://securetoken.googleapis.com https://*.firebaseio.com https://cdn.firebase.com https://www.google.com; object-src 'self'",

  "oauth2": {
    "client_id": "",
    "scopes": [
      "https://www.googleapis.com/auth/userinfo.email",
      "https://www.googleapis.com/auth/userinfo.profile"
    ]
  },
  "key":""
}

Note: seems like I can put any client_id and it doesn’t make any difference (firebaseUI doesn’t work and firebase works anyway)

I was following this github steps and used the code base from the repo

Any input is much appreciated.

Google sign-in button not working in Chrome Extension

I have a firebase app that requires users to be authenticated using Google.
I managed to hook up all settings and users can read/write to their prospective database location on firebase.

The only issue is: I am trying to display the Google-Sign-In button inside a chrome extension pop up. Here is my manifest.json

{
    "manifest_version" : 2,
    "name" : "MY EXTENSION",
    "version" : "0.0.6",
    "browser_action" : {
        "default_popup" : "welcome.html"
    },
    "background" : {
        "scripts" : ["js/jquery.min.js","js/firebase.js","js/firebase_config.js","js/background.js"],
        "persistent" : false
    },
    "oauth2" : {
        "client_id" : "686230544294-m9jfmc18cneiandadq8riborrjmq36in.apps.googleusercontent.com",
        "scopes" : [
            "openid", "email", "profile"
        ]
    },
    "content_security_policy" : "script-src 'self' 'unsafe-eval' https://apis.google.com; object-src 'self'"

}

Here is my welcome.html:



    

        
        

    
    
        

Welcome. Please sign in

The pop up opens up with everything except for the button. When I inspect its console, I get the following error:

Uncaught uO
message: "Invalid cookiePolicy"stack: "gapi.auth2.ExternallyVisibleError: Invalid cookiePolicy↵ at new uO (https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en.iUeg......

From firebase side, I can see users signing in.
What am I doing wrong? why doesn’t the Sign-In button show up on the extension pop up?

Get Firebase idToken from Web App to Chrome Extension?

Our situation: A Firebase web app that does authentication via Twitter, we need a way to get information in the context of an arbitrary URL in the browser into that app with the currently logged-in user. Much like the Pocket extension. The JWT token via currentUser.getIdToken would be everything we need to know inside the Extension. Also, having users log in again inside the Extension, even if they’re already authenticated inside the Web App isn’t the best experience. So is there a secure way to communicate that token from our app domain to the Extension? Thank you!