Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio committed Apr 28, 2023
1 parent 96a6d9b commit 7f4120a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion auth/OpenAiAuth.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ func (auth *Authenticator) partSix(oldState string, redirectURL string) Error {

if resp.StatusCode == 302 {
auth.URL = resp.Header.Get("Location")
println(auth.URL)
return Error{}
} else {
err := NewError("__part_six", resp.StatusCode, resp.Status, fmt.Errorf("error: Check details"))
Expand All @@ -388,7 +389,7 @@ func (auth *Authenticator) partSix(oldState string, redirectURL string) Error {

}
func (auth *Authenticator) GetAccessToken() (string, Error) {
auth.URL = strings.Replace(auth.URL, "chat.openai.com/api/", "labs.openai.com/", 1)
auth.URL = strings.Replace(auth.URL, "chat.openai.com/api/", "openai.openai.auth0app.com/", 1)
resp, _ := auth.Session.Get(auth.URL)
defer resp.Body.Close()
if resp.StatusCode != 200 {
Expand Down
18 changes: 9 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ func main() {
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)
// 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)
}

0 comments on commit 7f4120a

Please sign in to comment.