Mereithhh/chatgpt-token

Not working

Opened this issue · 3 comments

Error:

node:events:491
      throw er; // Unhandled 'error' event
      ^

page.waitForSelector: Timeout 30000ms exceeded.
=========================== logs ===========================
waiting for locator('#password') to be visible
============================================================

Code:

import { ChatGPTAPI } from "chatgpt";
import { chatgptToken } from "chatgpt-token/module";
import * as dotenv from "dotenv"; // see https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import
dotenv.config();

var api;

async function initChat() {
  const token = await chatgptToken(process.env.USERNAME, process.env.PASSWORD);
  if (!token) {
    console.log("error");
  } else {
    console.log(token);
    api = new ChatGPTAPI({
      sessionToken: token,
    });
    // ensure the API is properly authenticated
    await api.ensureAuth();
  }
```

Ubuntu

403 Failed to refresh auth token: new Cloudflare protections

Sorry, this morning ChatGPT add some new protections , this package is not working now. I'm tring to find a solution.