Skip to content
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.

AllanOricil/chatgpt-authenticator

Repository files navigation

CI Workflow

ChatGPT Authenticator

This node library is based on this python implementation.

How to use

Create an Open AI account in this link.

Methods

//requests a new token or return a token that has already been fetched
chatGPTAuthTokenService.getToken() : <Promise>

//requests a new token
chatGPTAuthTokenService.refreshToken() : <Promise>

ES Modules

import { ChatGPTAuthTokenService } from "chat-gpt-authenticator";

const chatGptAuthTokenService = new ChatGPTAuthTokenService(
  "OPEN_AI_EMAIL",
  "OPEN_AI_PASSWORD"
);

(async () => {
  const token = await chatGptAuthTokenService.getToken();
  console.log(token);

  token = await chatGPTAuthTokenService.refreshToken();
  console.log(token);
})();

Common JS

const { ChatGPTAuthTokenService } = require("chat-gpt-authenticator");

const chatGPTAuthTokenService = new ChatGPTAuthTokenService(
  "OPEN_AI_EMAIL",
  "OPEN_AI_PASSWORD"
);

(async () => {
  let token = await chatGPTAuthTokenService.getToken();
  console.log(token);

  token = await chatGPTAuthTokenService.refreshToken();
  console.log(token);
})();