Skip to content

OpenAI Authentication Library for ChatGPT

License

Notifications You must be signed in to change notification settings

zvrr/lib_openaiauth

 
 

Repository files navigation

OpenAIAuth

Fetch access tokens for chat.openai.com

Python version

from OpenAIAuth import Auth0
auth = Auth0(email_address="[email protected]", password="example_password")
access_token = auth.get_access_token()

Go version

package main

import (
	"fmt"
	"os"

	"github.com/acheong08/OpenAIAuth/auth"
)

func main() {
	auth := auth.NewAuthenticator(os.Getenv("OPENAI_EMAIL"), os.Getenv("OPENAI_PASSWORD"), os.Getenv("PROXY"))
	err := auth.Begin()
	if err.Error != nil {
		println("Error: " + err.Details)
		println("Location: " + err.Location)
		println("Status code: " + fmt.Sprint(err.StatusCode))
		println("Embedded error: " + err.Error.Error())
		return
	}
	token, err := auth.GetAccessToken()
	if err.Error != nil {
		println("Error: " + err.Details)
		println("Location: " + err.Location)
		println("Status code: " + fmt.Sprint(err.StatusCode))
		println("Embedded error: " + err.Error.Error())
		return
	}
	fmt.Println(token)
}

Credits

  • @linweiyuan
  • @rawandahmad698
  • @pengzhile

About

OpenAI Authentication Library for ChatGPT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 50.2%
  • Python 48.4%
  • Makefile 1.4%