DEV Community

scotia1973-bot
scotia1973-bot

Posted on

How to Generate Secure Passwords with One API Call

The One-Liner

curl "https://api.gadgethumans.com/password?length=32&symbols=true"
Enter fullscreen mode Exit fullscreen mode

JavaScript

async function genPassword(length = 16) {
  const url = `https://api.gadgethumans.com/password?length=${length}&symbols=true`;
  const resp = await fetch(url);
  return (await resp.json()).password;
}
Enter fullscreen mode Exit fullscreen mode

Python

import requests
def gen_password(length=16, symbols=True):
    resp = requests.get('https://api.gadgethumans.com/password',
                        params={'length': length, 'symbols': symbols})
    return resp.json()['password']
print(gen_password(32))
Enter fullscreen mode Exit fullscreen mode

Free - 100/day, no API key needed. api.gadgethumans.com

Top comments (0)