BlueSnap integration with node js and angular - bluesnap

Need guidance to integrate the Bluesnap Payment gateway with nodejs and angular. As per developer Hub of bluesnap the on button submit the submitCredentials should be sent to bluesnap server and bluesnap server will sent back the card data. But i am not getting the response as stated in developer guide. When i sent the data to server in xml format then response i get is unautorization access.
Step 1 am Following is Get token from the server sample respose i am printing
{ response:
{ debugId: 2,
headers:
{ date: 'Tue, 14 Jun 2016 07:23:59 GMT',
server: 'BlueSnap-UK',
'set-cookie': [Object],
location: 'https://ws.bluesnap.com/services/2/payment-fields-tokens/a55d11bc16322318f3cabf39b66e698e1f2087327bc03edb960c6f519f3681f2_2',
'content-length': '0',
'keep-alive': 'timeout=2, max=80',
connection: 'Keep-Alive',
'content-type': 'text/plain; charset=UTF-8',
f5: '/Common/web-vlan20-https 10.11.20.15%20 443',
'strict-transport-security': 'max-age=31536000 ; includeSubDomains' },
statusCode: 201,
body: '' } }
In the header location i am getting the token
Step 2 : Need to encrypt the sensative field and javascript is given by bluesnap to do that.
Step 3. need to submit the details to bluesnap server with token. and server will response with carddata
Step 4. Need to give server to server call to https://ws.bluesnap.com/services/2/transactions where i am receiving unautorize or status code 403
Please guide me to resolve this issue

I looked at your setup and some roles are missing, you need to contact Bluesnap support or Onboarding and ask for the correct permissions to be granted in Production.
If you is still in development mode you should test against the Sandbox where you have the correct permissions.
Can you send your payment page example. I think you are not calling bluesnap.submitCredentials function correctly.
Thanks

Related

Connect with PayPal - invalid_client Client Authentication failed with sandbox

I am implementing Connect With PayPal on my vuejs application following this documentation, but I keep getting an invalid_client error when I try to get the access token.
I have created the sandbox REST app on my account and I've enabled "Connect With PayPal". I have also set my return url in the app settings. To build the button I used the button builder and specified my client id, return url and set auth end point as "sandbox". I have added the external script in my index.html and the paypal.use() method in my component.
So now I have the connect button on my interface and when I click on it I am redirected to https://www.sandbox.paypal.com/connect/ which is normal. I can login with my two default sandbox accounts, then I am redirected to the return url that I specified in my app settings, with two url parameters : "code" and "scope" as described in the documentation.
However I am stuck at this step where I need to get an access token for the connected user.
I have tried to run this curl request with my client id / secret and the code from the url but as I said before it doesn't work and I am getting this error everytime :
HTTP/1.1 401 Unauthorized
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Content-Length: 77
Content-Type: application/json
Date: Wed, 08 Jul 2020 22:01:03 GMT
Paypal-Debug-Id: 8abaa5940b688
X-Paypal-Token-Service: IAAS
{
"error":"invalid_client",
"error_description":"Client Authentication failed"
}
I have checked my client id and secret multiple times and I can't understand why this is not working, does anyone have an idea ?
Solution for this type of error is to verify and validate everything is being sent correctly in the request, and properly encoded
curl's -u flag makes username:password header authentication easier
curl's -v flag will give visibility about the actual communication, to validate

Getting HTTP 400 when requesting access token

I am trying link Actions on Google with a 3rd party service (non-Google). I am using Google Oauth 2.0 Playground to check if I am getting the auth code and the access token. I successfully received the auth code but when requesting the access token I am receiving the following result from the response.
HTTP/1.1 400 Bad Request
Content-length: 16
Content-type: text/plain
WWW-Authenticate
I am not sure when I am doing wrong here. What does WWW-Authenticate mean?
Thanks in advance.

OneDrive API: Unauthenticated, Must be authenticated to use '/drive' syntax

I am using OneDrive api to upload files in my Ruby on Rails application and OneDrive API started giving the unauthenticated error on uploading file using the endpoint /drive/root:/#{filename}:/content. The error is given below:
{"error"=>{"code"=>"unauthenticated", "message"=>"Must be authenticated to use '/drive' syntax"}}
Then I got a new refresh_token by following the OneDrive Docs using scope files.readwrite offline_access.
For OneDrive authentication, I am sending POST request to the endpoint https://login.microsoftonline.com/common/oauth2/v2.0/token to get access_token using the refresh_token with the following headers and body:
headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
body = {
'client_id' => "<Client ID>",
'grant_type' => "refresh_token",
'redirect_uri' => "<Redirect URI>",
'client_secret' => "<Client Secret>",
'refresh_token' => "<Refresh Token>",
}
Am I using the correct endpoint to get access_token from refresh_token?
The base uri I am using to upload files to OneDrive is https://api.onedrive.com/v1.0
Can anyone please help me why I am I getting unauthenticated error or how can I use '/drive' syntax for authentication?
Thanks in advance!
Solved:
In my case, I was using "Code flow" for the Authentication and using the following url to get code in parameter:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=CLIENT_ID&scope=files.readwrite offline_access&response_type=code&redirect_uri=REDIRECT_URI
Visiting the above url opened the redirect url with a long code parameter which I was using to get access_token and refresh_token but that access_token was not working on uploading files to OneDrive and retuning "unauthenticated" error mentioned in question.
After doing research, I found that the url I am using to get code for OneDrive authentication is for Microsoft Graph. The correct url for Microsoft Account is given below:
https://login.live.com/oauth20_authorize.srf?client_id=CLIENT_ID&scope=onedrive.readwrite offline_access&response_type=code&redirect_uri=REDIRECT_URI
Visiting the above url in browser redirected me to the page with code parameter as well but it was small code like K9vb4e786-afg6-1a3b-1234-12abc01234ca.
I used this code to get access_token and refresh_token using the below POST request:
body = {
client_id: "CLIENT_ID",
redirect_uri: "REDIRECT_URI",
client_secret: "CLIENT_SECRET",
code: "CODE",
grant_type: "authorization_code"
}
headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
r=HTTParty.post('https://login.live.com/oauth20_token.srf', headers: headers, body: body)
This request returned access_token and refresh_token in response. I used this refresh_token to get an access_token in each request and file uploaded successfully.
Conclusion: I was using Microsoft Graph authentication process ie, https://learn.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/graph-oauth which was incorrect. Then I followed Microsoft Account authentication ie, https://learn.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/msa-oauth which resolved the issue.
Update:
Later I used my Office-365 business account for OneDrive file uploading. For this account, OneDrive authentication process is different ie, https://learn.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/aad-oauth and it worked.

TFS Web Calling an external REST Service throws 401 error

When creating a web hook within TFS (to access an external rest service url), I get a 401 error when testing (within the TFS application). I think call is not hitting API at all.
Below is the response I can see
Status Code: 401
Reason Phrase: Unauthorized
HTTP Version: 1.1
Headers:
{
Server: Microsoft-IIS/7.5
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET
X-UA-Compatible: IE=EmulateIE8
Date: Fri, 30 Mar 2018 21:05:26 GMT
Content-Length: 1293
Content-Type: text/html
}
Any help would be appreciated!
The error ID 401 usually related to the authorization.
You could first use postman to double check user ID access to the API.
Also use week hook to access some other rest service url such as the example in Web Hooks. This will narrow down if the issue related to rest service url.
Besides try to use Basic Authentication, you can use alternate account instead. How to please take a look at:Protecting a VSTS Web Hook with Basic Authentication

Paypal Adaptive Payments 500 proxy error

I'm seeing the following error message when attempting to perform a simple payment using the PayPal Adaptive Payments API and the Explicit Approval Payment Flow in the sandbox environment:
Proxy Error
The proxy server could not handle the request GET /webapps/adaptivepayment/flow/expresscheckoutincontextremembermeflow.
Reason: Error during SSL Handshake with remote server
As per this related post, this issue has supposedly been resolved, but I'm still unable to perform a simple payment in the sandbox environment.
The API call to generate a payKey is returning successfully:
{
'responseEnvelope': {
'ack': 'Success',
'timestamp': '2013-04-01T10:00:33.572-07:00',
'build': '5563463',
'correlationId': '9ddb6d34b8b31'
},
'paymentExecStatus': 'CREATED',
'payKey': 'AP-30241506EH984280M'
}
and the following series of redirects are occurring:
https:// www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay?expType=light&paykey=AP-30241506EH984280M
redirects to:
https:// www.sandbox.paypal.com/webapps/adaptivepayment/flow/payinit?iframecookie=1364835660832&paykey=AP-30241506EH984280M&expType=light
which redirects to:
https:// www.sandbox.paypal.com/webapps/adaptivepayment/flow/corepay
which redirects to:
https:// www.sandbox.paypal.com/webapps/adaptivepayment/flow/expresscheckoutincontextremembermeflow
which gives the 500 proxy error after approximately 210 seconds.
Additionally, if I attempt the workaround of logging into developer.paypal.com in another tab first, I get a 404 error on the initial request:
https:// www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay?expType=light&paykey=AP-45P14958V28124917
I've searched and searched and poked and prodded this issue to death...anyone else seeing this problem, and does anyone have a working resolution?
We are rolling a patch later tonight which we expect to fix this issue permanently.