Hi @alessandro belli ,
Try sending the credentials in the request body.
Dim url As String = "https://auth.sinch.com/oauth2/token"
Dim credentials As String = Convert.ToBase64String(Encoding.ASCII.GetBytes("Myusername:Mypassword"))
Dim postData As String = "grant_type=client_credentials"
Using client As New WebClient()
client.Headers(HttpRequestHeader.Authorization) = "Basic " & credentials
client.Headers(HttpRequestHeader.ContentType) = "application/x-www-form-urlencoded"
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
Dim responseBytes As Byte() = client.UploadData(url, "POST", Encoding.ASCII.GetBytes(postData))
Dim responseBody As String = Encoding.ASCII.GetString(responseBytes)
Console.WriteLine(responseBody)
End Using
Best Regards.
Jiachen Li
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.