c# - The remote server returned an error: (401) Unauthorized on Pay Fabric service -
i using below code token pay fabric service. facing error while doing so: "the remote server returned error: (401) unauthorized". have been doing net searching several hours didn't find helpful.
var url = "https://sandbox.payfabric.com/payment/api/token/create"; httpwebrequest httpwebrequest = webrequest.create(url) httpwebrequest; httpwebrequest.contenttype = "application/json; charset=utf-8"; httpwebrequest.method = "get"; httpwebrequest.headers["authorization"] = "deviceid/password"; servicepointmanager.securityprotocol = (securityprotocoltype)3072; //at line getting error. httpwebresponse httpwebresponse = httpwebrequest.getresponse() httpwebresponse; // stream responsestream = httpwebresponse.getresponsestream(); streamreader streamreader = new streamreader(responsestream); string result = streamreader.readtoend(); streamreader.close(); responsestream.close(); httpwebrequest.abort(); httpwebresponse.close(); // parse json response tokenresponse obj = jsonhelper.jsondeserialize<tokenresponse>(result); return obj.token; any appreciated.
Comments
Post a Comment