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

339
Visualizações
Receiving 401 Unauthorized error in Sendgrid with Strapi

I'm trying to add a "forgot password" link in my application, using the built-in API provided by Strapi. I've included the configuration for Sendgrid in config/plugins.js:

module.exports = ({ env }) => ({
    email: {
      provider: "sendgrid",
      providerOptions: {
        apiKey: env('SENDGRID_API_KEY'),
      },
      settings: {
        defaultFrom: "myemail@gmail.com",
        defaultReplyTo: "myemail@gmail.com",
      },
    },
  });

Every answer I find about this error is about adding the API key in the environment variables, which I've already done (and re-done) several times. I also re-created my API key twice, in case it expired, but it's still the same. I don't understand, it was working perfectly well a couple days ago but now I'm stuck on this error. Any idea what could be the issue here?

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

Probably indeed the expression env('SENDGRID_API_KEY') is not resolving the correct api key. You can also directly put your api key in the json like this:

module.exports = ({ env }) => ({
email: {
  provider: "sendgrid",
  providerOptions: {
    apiKey: 'SG.MY_SENDGRID_API_KEY',// <== not using the env function
  },
  settings: {
    defaultFrom: "myemail@gmail.com",
    defaultReplyTo: "myemail@gmail.com",
  },
},

});

If this works, the plugin is working, and you can focus on why the env() function is not resolving the variable

about 4 years ago · Santiago Gelvez Relatório
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