Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

205
Visualizações
Data doesn't store in chrome.storage.local from popup for chrome extension

I am creating a chrome extension, when you click on the extension icon you will be asked to sing in or sign up.

enter image description here

When click "sign in" button a window will popup (see below) and ask you to enter your credentials.

enter image description here

I am using Firebase, so after the user sign in I want to store their UserID in local storage.

chrome.storage.local.set({UserID: userCredential.user.uid}, function(){
        chrome.storage.local.get(["UserID"], function(result) {
          console.log('Value currently is ' + result.key);
        });
        console.log("Stored in storage")
      })

console.log('Value currently is ' + result.key) prints Value currently is undefined and when I look at the localstorage using DevTools, there is nothing there. There is no issue with my firebase code, when I do console.log(userCredential.user.uid) it prints the correct info.

This is my permission in manifest.json:

"permissions": [
    "tabs",
    "activeTab",
    "scripting",
    "*://*/*",
    "storage",
    "identity"
]

I want to store the userID in local storage, so when the user clicks on the extension icon, the extension checks to see if userID exists in local storage, and if userID is in local storage then it will display the user info. If there is no userID it will display the "Sign In/Sign Up" buttons.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda