Greetings everyone,
I've been attempting to retrieve payment configurations information via an HTTP request, but unfortunately, it's consistently failing.
I can confirm that my subscription is active. Strangely, when I test this functionality in the SKY API Console environment, it operates as expected. However, when attempting the same task through ASP.NET with VB.NET source code, I encounter difficulties.
Could it be that a specific framework is required for this operation? It's worth noting that I am not utilizing .NET Core. Below, I've provided a snippet of the code used. Unfortunately, it results in an error stating: {"error":"invalid_scope","error_description":"The scope parameter was not included in the request"}
Public Shared Sub Main()
ServicePointManager.SecurityProtocol = ServicePointManager.SecurityProtocol Or SecurityProtocolType.Tls12
Dim accessToken = GetAccessToken().GetAwaiter().GetResult()
Console.WriteLine("Access Token: " & accessToken)
End Sub
Public Shared Async Function GetAccessToken() As Task(Of String)
Dim httpClient As New HttpClient()
Dim clientId As String = ""
Dim clientSecret As String = ""
Dim requestBody As String = $"grant_type=client_credentials&client_id={clientId}&client_secret={clientSecret}"
'Dim response = Await httpClient.PostAsync("https://app.blackbaud.com/oauth/authorize?", New StringContent(requestBody, System.Text.Encoding.UTF8, "application/x-www-form-urlencoded"))
Dim response = Await httpClient.PostAsync("https://oauth2.sky.blackbaud.com/token", New StringContent(requestBody, System.Text.Encoding.UTF8, "application/x-www-form-urlencoded"))
Dim jsonResponse As String = Await response.Content.ReadAsStringAsync()
Dim accessToken As String = jsonResponse.Split(""""c)(3)
Return accessToken
End Function
End Class