Project title:
vb.net sub to connect to API using certificate. Yes that simple
Posted by:
External project from PeoplePerHour
Started:
20-Dec-2022 11:26 GMT
Description:
I have a very simple project. I only need a good response back from an API. The code is working in postman however I am getting a 502 error in vb.net using WebClient and HttpWebRequest. I will provide the .pfx certificate and postman curl as well as my code. At a loss on how to correct this as it looks fine to me in the trace file. I had this code working at one time but after I migrated from visual studio enterprise to visual studio professional I am no longer able to connect. curl --location --request POST 'https://card-sandbox.api.fiservapps.com/cs/oauth2/v1/token?scope=/cs/api' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --header 'x-fapi-financial-id: 12345678' \ --header 'Authorization: Basic S212SGs1bERZaUIxUlB1cVNVODVZOFRVR25rWTE1OUE6TUMxZDdSQWRoUkdLQ2JTTw==' \ --data-urlencode 'grant_type=client_credentials' Code Private Sub TestConnection() Dim PrivateKeyPath As String = "C:\Backup\JHACPSCardClient Core Dir New Pin Pad FISERV - Copy\bin\Debug\SANDBOXSITE_API.pfx" Dim CertificatePassword As String = "Zk7XD3FG5ycW2suc" Dim cert As New X509Certificate2(PrivateKeyPath, CertificatePassword, X509KeyStorageFlags.Exportable) Dim handler As New WebRequestHandler() handler.ClientCertificates.Add(cert) Dim client As New HttpClient(handler) ' client.DefaultRequestHeaders.Add("Content-Type", "application/x-www-form-urlencoded") client.DefaultRequestHeaders.Accept.Add(New Headers.MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded")) client.DefaultRequestHeaders.Add("x-fapi-financial-id", "12345678") client.DefaultRequestHeaders.Add("Authorization", "Basic S212SGs1bERZaUIxUlB1cVNVODVZOFRVR25rWTE1OUE6TUMxZDdSQWRoUkdLQ2JTTw==") Dim formData As New FormUrlEncodedContent(New Dictionary(Of String, String) From {{"grant_type", "client_credentials"}}) Dim response As HttpResponseMessage = client.PostAsync(https://card-sandbox.api.fiservapps.com/cs/oauth2/v1/token?scope=/cs/api, formData).Result If response.IsSuccessStatusCode Then Dim responseContent As String = response.Content.ReadAsStringAsync().Result ' Do something with the response Else ' Handle error End If End Sub
Project ID:
3300764
Project category:
Project budget:
Project
Started
UN LOGO POUR UNE APPLICATION DE DENTISTE
Category : Graphic Design, Illustration, Logo Design, Photoshop, Photoshop Design Budget : $250 - $750 USD
27-Apr-2024 22:03 GMT
YouTube SEO Keyword Editor - Full-Time
Category : Internet Marketing, SEO, Social Engine, Social Media Management, Social Media Marketing Budget : ₹20000 - ₹25000 INR
27-Apr-2024 22:03 GMT
Personalized Hugging Face Model Interface
Category : Java, Linux, Machine Learning (ML), Python, Software Architecture Budget : $30 - $250 USD
27-Apr-2024 22:02 GMT
Google Chrome Extension Development
Category : Extensions & Additions, Firefox, Google Chrome, JavaScript, Software Architecture Budget : $10 - $30 USD
27-Apr-2024 22:01 GMT
Expert Web Developer for cPanel Migration
Category : Graphic Design, HTML, PHP, Web Design, WordPress Budget : £20 - £250 GBP
27-Apr-2024 21:59 GMT
Corporate Working Conditions Improvement study
Category : Article Writing, Internet Research, Report Writing, Research, Research Writing Budget : €30 - €250 EUR
27-Apr-2024 21:58 GMT
Tech Sales Development Closer Wanted
Category : B2B Marketing, Closer, Sales Budget : €750 - €1500 EUR
27-Apr-2024 21:57 GMT
Photorealistic Architectural Render Presentation
Category : 3D Animation, 3D Modelling, 3D Rendering, 3ds Max, Interior Design Budget : €8 - €30 EUR
27-Apr-2024 21:55 GMT
Cross-Platform App Submission Assistance
Category : Android, Dart, Flutter, IPhone, Mobile App Development Budget : $30 - $250 USD
27-Apr-2024 21:51 GMT
AI-Powered Developer workflow for tenders / Data Entry & Document Management
Category : AI (Artificial Intelligence) HW / SW, AI Development, Artificial Intelligence, Generative AI, OpenAI Budget : $250 - $750 USD
27-Apr-2024 21:49 GMT
Machine Learning Model for Outcome Prediction
Category : Data Science, Deep Learning, Machine Learning (ML), Python, Statistical Analysis Budget : ₹100 - ₹400 INR
27-Apr-2024 21:48 GMT
Godot 4 engine
Category : Godot, Scripting Budget : €8 - €30 EUR
27-Apr-2024 21:48 GMT
Krypto coin
Category : C++, Programming, HTML, Java, PHP, Python Budget : €250 - €750 EUR
27-Apr-2024 21:44 GMT
Logo for Pan-American Armwrestling Representation
Category : Graphic Design, Icon Design, Illustration, Logo Design, Photoshop Budget : $10 - $30 USD
27-Apr-2024 21:42 GMT
Desarrollo de App Móvil para Gestión de Actividades con Reporte de Estado y Evidencia Fotográfica
Category : Android, Flutter, Laravel, Mobile App Development, PHP Budget : $30 - $250 USD
27-Apr-2024 21:41 GMT
Browse All Projects