(refreshToken string, proxy string)
| 1844 | } |
| 1845 | |
| 1846 | func (h *Handler) accessTokenFromRefreshToken(refreshToken string, proxy string) (string, int, error) { |
| 1847 | client := bogdanfinn.NewStdClient() |
| 1848 | result, status, err := chatgpt.GETTokenForRefreshToken(client, refreshToken, proxy) |
| 1849 | if status == 0 { |
| 1850 | status = http.StatusBadRequest |
| 1851 | } |
| 1852 | if err != nil { |
| 1853 | return "", status, err |
| 1854 | } |
| 1855 | if data, ok := result.(map[string]interface{}); ok { |
| 1856 | if accessToken, ok := data["access_token"].(string); ok && accessToken != "" { |
| 1857 | return accessToken, status, nil |
| 1858 | } |
| 1859 | } |
| 1860 | return "", status, errors.New("refresh token response did not include access_token") |
| 1861 | } |
| 1862 | |
| 1863 | func isUUID(str string) bool { |
| 1864 | _, err := uuid.Parse(str) |
no test coverage detected