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

235
Visualizações
Are there any public API (s) that I could use to verify an activation code?

I am trying to create a product verification system, and I have the login part down. My question is how are there any API (s) that can verify something like an activation code and return if it succeeded or not. Btw, you might have to scroll horizontally to see all of the code

//How would I add a verification system
document.getElementById('redeemButton').addEventListener('click', () => {
  var code = document.getElementById('redeemCodeBox').value;
  var product = document.getElementById('productCode').value;

  const fetchPromise = fetch(`https://www.mywebsite.com/api/redeem?product=${product}&code=${code}`);

fetchPromise.then( response => {
    if (!response.ok) {
      throw new Error(`HTTP error: ${response.status}`);
    }
    return response.json();
  })
  
  .then( json => {
    console.log(json[0].name);
  })
  
  .catch( error => {
    console.error(`Could not get products: ${error}`);
    throw `Please Enter a Valid Activation Code`;
  });
});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I don't think you should be dependent on a third party to verify an Activation Code.

You should use a combination of JWT token + activation code that you store in the database.

  1. Generate an activation code.

  2. Generate JWT token.

    const token = await this.jwtService.sign( { usetId: userId }, { expiresIn: "1d" } );

  3. Save the activation code and the JWT token to the database.

  4. Send an E-mail or SMS with an activation code to the user. + include URL where user can insert the activation code.

URL can look something like this:

https://www.mywebsite.com/api/activation?token=eyJhbGciOiJIfasdfas

(use query parameter for JWT token =>> ?token=JWT_token

  1. Verify JWT token from URL (value from query parameter "token") and validate if Token is not expired.

  2. Control if user input matches an Activation code stored in your database.

  3. Activated

about 4 years ago · Juan Pablo Isaza 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