Skip to content

Commit

Permalink
fix: data input
Browse files Browse the repository at this point in the history
  • Loading branch information
DDSRem committed Aug 12, 2024
1 parent b62f4b3 commit 4d0dbb0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions aliyuntvtoken_connector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,20 @@ func decrypt_AES256_CBC_PKCS7(ciphertext, key, iv string) (string, error) {

func main() {
http.HandleFunc("/oauth/alipan/token", func(w http.ResponseWriter, r *http.Request) {
body, _ := io.ReadAll(r.Body)

refresh_token := gjson.Get(string(body), "refresh_token").String()
r.ParseForm()
refresh_token := r.FormValue("refresh_token")
if refresh_token == "" {
var body map[string]interface{}
err := json.NewDecoder(r.Body).Decode(&body)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
if val, ok := body["refresh_token"]; ok {
refresh_token = val.(string)
}
}
fmt.Println(refresh_token)
reqBodyJson := `{"refresh_token": "` + refresh_token + `"}`

resp, err := http.Post("http://api.extscreen.com/aliyundrive/v2/token", "application/json", strings.NewReader(reqBodyJson))
Expand Down

0 comments on commit 4d0dbb0

Please sign in to comment.