This node library is based on this python implementation.
Create an Open AI account in this link.
//requests a new token or return a token that has already been fetched
chatGPTAuthTokenService.getToken() : <Promise>
//requests a new token
chatGPTAuthTokenService.refreshToken() : <Promise>
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);
})();
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);
})();