Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

238
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!