Rishikant181 / Rettiwt-API

A CLI tool and an API for fetching data from Twitter for free!
https://rishikant181.github.io/Rettiwt-API/
MIT License
491 stars 46 forks source link

When setting api key in .env, client is in guest auth mode #504

Closed randyyu13 closed 8 months ago

randyyu13 commented 8 months ago

I tried moving my api key from a test script to a .env file and loading it with env.TWITTER_KEY and when I run user.timeline it returns what the timeline would look like from a guest user instead of an authenticated user. Any ideas on how to properly do this?

randyyu13 commented 8 months ago

My setup: script.js:

const apiKey = process.env.TWITTER_KEY; const rettiwt = new Rettiwt({ apiKey });

randyyu13 commented 8 months ago

.env:

TWITTER_KEY='api key'

Rishikant181 commented 8 months ago

The correct syntax is:

const twitterKey = process.env.TWITTER_KEY;
const rettiwt = new Rettiwt({ apiKey: twitterKey })