OpenAIAuth

command module
v0.0.0-...-223d31b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 3 Imported by: 0

README

OpenAIAuth

Fetch access tokens for chat.openai.com

Python version

from OpenAIAuth import Auth0
auth = Auth0(email_address="example@example.com", password="example_password")
access_token = auth.get_access_token()

Go version

package main

import (
	"fmt"
	"os"

	"github.com/xqdoo00o/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))
		return
	}
	token, err := auth.GetAccessToken()
	if err.Error != nil {
		println("Error: " + err.Details)
		println("Location: " + err.Location)
		println("Status code: " + fmt.Sprint(err.StatusCode))
		return
	}
	fmt.Println(token)
}

Credits

  • @linweiyuan
  • @rawandahmad698
  • @pengzhile

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL