我正在尝试创建一个 http 请求以使用存储的刷新令牌获取新的访问令牌,以便我可以访问 Google 云端硬盘。
Dim uri As String = "https://accounts.google.com/o/oauth2/token"
Dim para As String = "code='" + cred.RefreshToken + "'&client_id='" + ClientCredentials.CLIENT_ID + "'&client_secret='" + ClientCredentials.CLIENT_SECRET + "'&grant_type='refresh_token'"
Dim httpWebRequest As System.Net.HttpWebRequest = Net.WebRequest.Create(uri)
httpWebRequest.Method = "POST"
httpWebRequest.ContentType = "application/x-www-form-urlencoded"
Dim requestStream As System.IO.Stream = httpWebRequest.GetRequestStream()
Dim streamwriter As System.IO.StreamWriter = New System.IO.StreamWriter(requestStream)
streamwriter.Write(para)
streamwriter.Close()
Dim httpWebResponse As System.Net.HttpWebResponse = httpWebRequest.GetResponse()
但这会返回一个错误的请求。我错过了什么?