How do I use a specific TLS version with `node-fetch` like TLS v1.2?
Asked Answered
H

1

0

I'm getting a 403 FORBIDDEN error and need to set the TLS version to TLS v1.2 with fetch calls using the node-fetch library. How do I do that?

Hypermetropia answered 30/9, 2023 at 15:29 Comment(0)
H
1

I figured it out:

You can use the tls library to do it.

const tls = require('tls');

tls.DEFAULT_MIN_VERSION = 'TLSv1.2';

const response = await fetch(...);
...
Hypermetropia answered 30/9, 2023 at 15:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.