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

The apikey could not be generated #530

Closed spencer17x closed 6 months ago

spencer17x commented 6 months ago
image

When i use npx rettiwt auth login <email> <username> <password>

The apikey could not be generated and there is no output

Rishikant181 commented 6 months ago

Can you try: npx rettiwt auth login <username> <email> <password>

spencer17x commented 6 months ago

I tried one and it didn't work

Rishikant181 commented 6 months ago

Are you able to log into the same account from a browser?

spencer17x commented 6 months ago

Are you able to log into the same account from a browser?

Yeah

Rishikant181 commented 6 months ago

Do you have 2FA or something enabled?

spencer17x commented 6 months ago

Do you have 2FA or something enabled?

No

Rishikant181 commented 6 months ago

That's strange, any other account(s) that you tried?

Have you tried enclosing email, username and passworld in double quotes as in: npx rettiwt auth login "email@domain.com" "user_name" "pass_word"?

spencer17x commented 6 months ago

That's strange, any other account(s) that you tried?

Have you tried enclosing email, username and passworld in double quotes as in: npx rettiwt auth login "email@domain.com" "user_name" "pass_word"?

i tried this, and get a big reponse, is it correct?

Rishikant181 commented 6 months ago

If the response is a long string, then it's correct:

aWYgeW91IHNlZSBzb21ldGhpbmcgbGlrZSB0aGlzLCB0aGVuIGl0J3MgbW9zdCBwcm9iYWJseSBjb3JyZWN0LiBpZiB5b3Ugc2VlIHNvbWV0aGluZyBsaWtlIHRoaXMsIHRoZW4gaXQncyBtb3N0IHByb2JhYmx5IGNvcnJlY3QuIGlmIHlvdSBzZWUgc29tZXRoaW5nIGxpa2UgdGhpcywgdGhlbiBpdCdzIG1vc3QgcHJvYmFibHkgY29ycmVjdC4gaWYgeW91IHNlZSBzb21ldGhpbmcgbGlrZSB0aGlzLCB0aGVuIGl0J3MgbW9zdCBwcm9iYWJseSBjb3JyZWN0LiBpZiB5b3Ugc2VlIHNvbWV0aGluZyBsaWtlIHRoaXMsIHRoZW4gaXQncyBtb3N0IHByb2JhYmx5IGNvcnJlY3Qu

Note: This is just some random gibbersh string I came up with, but you get the spirit

spencer17x commented 6 months ago

And when my code is

aWYgeW91IHNlZSBzb21ldGhpbmcgbGlrZSB0aGlzLCB0aGVuIGl0J3MgbW9zdCBwcm9iYWJseSBjb3JyZWN0LiBpZiB5b3Ugc2VlIHNvbWV0aGluZyBsaWtlIHRoaXMsIHRoZW4gaXQncyBtb3N0IHByb2JhYmx5IGNvcnJlY3QuIGlmIHlvdSBzZWUgc29tZXRoaW5nIGxpa2UgdGhpcywgdGhlbiBpdCdzIG1vc3QgcHJvYmFibHkgY29ycmVjdC4gaWYgeW91IHNlZSBzb21ldGhpbmcgbGlrZSB0aGlzLCB0aGVuIGl0J3MgbW9zdCBwcm9iYWJseSBjb3JyZWN0LiBpZiB5b3Ugc2VlIHNvbWV0aGluZyBsaWtlIHRoaXMsIHRoZW4gaXQncyBtb3N0IHByb2JhYmx5IGNvcnJlY3Qu

No, i get a big object...

Rishikant181 commented 6 months ago

In that case, it would be better if you post the response, because that's totally not intended behaviour

spencer17x commented 6 months ago

And when my code is like this:

const rettiwt = new Rettiwt();
rettiwt.auth.login(
        twitterConfig.email,
        twitterConfig.username,
        twitterConfig.password
    ).then(apiKey => {
console.log(apiKey)
});

it gives me a error:

API key: TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"

Rishikant181 commented 6 months ago

Are you using a proxy perhaps?

spencer17x commented 6 months ago

Are you using a proxy perhaps?

I didn't write a proxy configuration in the code, but I did use a vpn

spencer17x commented 6 months ago

In that case, it would be better if you post the response, because that's totally not intended behaviour

The strange thing is that he has no return now

Rishikant181 commented 6 months ago

Now VPN is something I've never tested the library with.

Just for the sake of generating an api key, can you just turn off the VPN, generate an api key, then turn it back on to see if it works?

spencer17x commented 6 months ago

Now VPN is something I've never tested the library with.

Just for the sake of generating an api key, can you just turn off the VPN, generate an api key, then turn it back on to see if it works?

If I turn it off, I won't be able to access Twitter

Rishikant181 commented 6 months ago

I'll be opening up an issue now. Any further developments regarding this issue with VPNs will be posted there.

I apologize for the inconvenience.

spencer17x commented 6 months ago

I'll be opening up an issue now. Any further developments regarding this issue with VPNs will be posted there.

I apologize for the inconvenience.

Thanks!

spencer17x commented 6 months ago

Now I switched to a vpn and reported this error:

AxiosError: Request failed with status code 503 at settle (/Users/17a/Desktop/project/twitter-bot/node_modules/.pnpm/axios@1.6.3/node_modules/axios/lib/core/settle.js:19:12) at IncomingMessage.handleStreamEnd (/Users/17a/Desktop/project/twitter-bot/node_modules/.pnpm/axios@1.6.3/node_modules/axios/lib/adapters/http.js:585:11) at IncomingMessage.emit (node:events:525:35) at IncomingMessage.emit (node:domain:489:12) at endReadableNT (node:internal/streams/readable:1358:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) { code: 'ERR_BAD_RESPONSE', config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [ 'xhr', 'http' ], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, env: { FormData: [Function], Blob: null }, validateStatus: [Function: validateStatus], headers: Object [AxiosHeaders] { Accept: 'application/json, text/plain, /', 'Content-Type': 'application/x-www-form-urlencoded', authorization: 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA', 'User-Agent': 'axios/1.6.3', 'Accept-Encoding': 'gzip, compress, deflate, br' }, httpsAgent: Agent { _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, defaultPort: 443, protocol: 'https:', options: [Object: null prototype], requests: [Object: null prototype] {}, sockets: [Object: null prototype] {}, freeSockets: [Object: null prototype] {}, keepAliveMsecs: 1000, keepAlive: false, maxSockets: Infinity, maxFreeSockets: 256, scheduling: 'lifo', maxTotalSockets: Infinity, totalSocketCount: 0, maxCachedSessions: 100, _sessionCache: [Object],

},
method: 'post',
url: 'https://api.twitter.com/1.1/guest/activate.json',
data: undefined

}, request: <ref 1> ClientRequest { _events: [Object: null prototype] { abort: [Function (anonymous)], aborted: [Function (anonymous)], connect: [Function (anonymous)], error: [Function (anonymous)], socket: [Function (anonymous)], timeout: [Function (anonymous)], prefinish: [Function: requestOnPrefinish] }, _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: true, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, _closed: false, socket: Socket { connecting: false, _hadError: false, _parent: null, _host: null, _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 7, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: false, _sockname: null, _pendingData: null, _pendingEncoding: '', server: null, _server: null, parser: null, _httpMessage: [Circular 1],

  [Symbol(kHandle)]: [TCP],
  [Symbol(lastWriteQueueSize)]: 0,
  [Symbol(timeout)]: null,
  [Symbol(kBuffer)]: null,
  [Symbol(kBufferCb)]: null,
  [Symbol(kBufferGen)]: null,
  [Symbol(kCapture)]: false,
  [Symbol(kSetNoDelay)]: false,
  [Symbol(kSetKeepAlive)]: true,
  [Symbol(kSetKeepAliveInitialDelay)]: 60,
  [Symbol(kBytesRead)]: 0,
  [Symbol(kBytesWritten)]: 0,
  [Symbol(RequestTimeout)]: undefined
},
_header: 'POST https://api.twitter.com/1.1/guest/activate.json HTTP/1.1\r\n' +
  'Accept: application/json, text/plain, */*\r\n' +
  'Content-Type: application/x-www-form-urlencoded\r\n' +
  'authorization: Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA\r\n' +
  'User-Agent: axios/1.6.3\r\n' +
  'Accept-Encoding: gzip, compress, deflate, br\r\n' +
  'host: api.twitter.com\r\n' +
  'Connection: close\r\n' +
  'Content-Length: 0\r\n' +
  '\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: Agent {
Rishikant181 commented 6 months ago

Status code 503 usually implies that the server is too busy and is unable to process any further requests. Still, I'm trying to reproduce the issue on my VPN (ProtonVPN).

spencer17x commented 6 months ago

Status code 503 usually implies that the server is too busy and is unable to process any further requests. Still, I'm trying to reproduce the issue on my VPN (ProtonVPN).

I have now switched to a vpn and found that it works

Rishikant181 commented 6 months ago

So, @spencer17x everything works now?

spencer17x commented 6 months ago

So, @spencer17x everything works now?

Yeah