Rob--W / cors-anywhere

CORS Anywhere is a NodeJS reverse proxy which adds CORS headers to the proxied request.
MIT License
8.5k stars 5.92k forks source link

add option to add auth header for sites like reddit #479

Closed sharan21 closed 5 months ago

sharan21 commented 5 months ago

this is how it would be like for a simple python request, i want to do the same thing here:

import requests
import base64

client_id = 'your-client-id;
client_secret = 'your-client-secret'

# Encode the client ID and client secret
credentials = '{}:{}'.format(client_id, client_secret)
credentials_b64 = base64.b64encode(credentials.encode()).decode()

# Make the request
url = 'https://www.reddit.com/your-endpoint'
headers = {
    'Authorization': 'Basic {}'.format(credentials_b64),
    'User-Agent': 'your agent name'
}
response = requests.get(url, headers=headers)

# Handle the response
print(response.text)

any advise on how this can be done and what lines need to be changed? Sorry I suck at js.

Rob--W commented 5 months ago

Your question here has nothing to do with this project, thus I'm closing it.

If you are wondering about how to send requests from a web browser, see:

If you are wondering about how to send http(s) request from Node.js with core libraries, see