Nishant
Nishant

Reputation: 115

Paypal Permissions API Java SDK: GetBasicPersonalData:Getting Authentication failed

Scenario:

I am using the latest permissions API version 1.1.93 from x.com in sandbox mode. I am using sandbox credentials to test the functionality.

Problem::

The getBasicPersonalData and getAdvancedPersonalData are not working when I run it using Junit. (though getPermissions and cancelPermissions are working fine)

I am getting API credentials are incorrect. Though details are 100% correct

When I am running the sdk provided permission-sample war file with same credentials it works fine.

*I have even copy-pasted the sdk_config.properties file to make sure that I am using the correct properties.*

I also compared the header, paypload and request information, All appear to be exactly the same.

*PS: Please refrain from saying I am using wrong credentials, checked it 1000 times, I am using sandbox creds only, I have been told the same so many times :-) *

Below are the values I get when I call GetBasicPersonalData , used debugging to get these values

Header Value

{X-PAYPAL-REQUEST-DATA-FORMAT=NV, X-PAYPAL-APPLICATION-ID=APP-80W284485P519543T, X-PAYPAL-DEVICE-IPADDRESS=127.0.0.1, X-PAYPAL-REQUEST-SOURCE=sdk-permissions-java-1.1.93, X-PAYPAL-AUTHORIZATION=token=uJvLxPmOCPVQbfVSxkH29I53Q6c5gd6XvY40ygCQxpbpOJOWrWQ-nA,signature=4cpQsfOD7d2g39P5Crq6yPbIYLE=,timestamp=1349383673, [email protected], X-PAYPAL-RESPONSE-DATA-FORMAT=NV}

Payload

requestEnvelope.errorLanguage=en_US&attributeList.attribute(0)=http://axschema.org/namePerson/first&attributeList.attribute(1)=http://axschema.org/namePerson/last&attributeList.attribute(2)=http://axschema.org/contact/email&attributeList.attribute(3)=http://schema.openid.net/contact/fullname&attributeList.attribute(4)=http://axschema.org/company/name&attributeList.attribute(5)=http://axschema.org/contact/country/home&attributeList.attribute(6)=https://www.paypal.com/webapps/auth/schema/payerID&

Response

responseEnvelope.timestamp=2012-10-04T13%3A48%3A48.416-07%3A00&responseEnvelope.ack=Success&responseEnvelope.correlationId=acc87fc89aad2&responseEnvelope.build=2210301&response.personalData(0).personalDataKey=http%3A%2F%2Faxschema.org%2Fcompany%2Fname&response.personalData(0).personalDataValue=Invoice+Sender+%27s+Test+Store&response.personalData(1).personalDataKey=http%3A%2F%2Faxschema.org%2Fcontact%2Fcountry%2Fhome&response.personalData(1).personalDataValue=GB&response.personalData(2).personalDataKey=http%3A%2F%2Faxschema.org%2Fcontact%2Femail&response.personalData(2).personalDataValue=invsd2_1349373629_biz%40bakingit.com&response.personalData(3).personalDataKey=http%3A%2F%2Faxschema.org%2FnamePerson%2Ffirst&response.personalData(3).personalDataValue=Invoice&response.personalData(4).personalDataKey=http%3A%2F%2Faxschema.org%2FnamePerson%2Flast&response.personalData(4).personalDataValue=Sender+&response.personalData(5).personalDataKey=http%3A%2F%2Fschema.openid.net%2Fcontact%2Ffullname&response.personalData(5).personalDataValue=Invoice+Sender+&response.personalData(6).personalDataKey=https%3A%2F%2Fwww.paypal.com%2Fwebapps%2Fauth%2Fschema%2FpayerID&response.personalData(6).personalDataValue=H4KY78FSAPYF4

Now when I use the same access token and token secret from a Junit test I get below equivalent and it gives an error “Authentication failed. API credentials are incorrect.”

I am using exactly the same credentials

Header

{X-PAYPAL-REQUEST-DATA-FORMAT=NV, X-PAYPAL-APPLICATION-ID=APP-80W284485P519543T, X-PP-AUTHORIZATION=token=uJvLxPmOCPVQbfVSxkH29I53Q6c5gd6XvY40ygCQxpbpOJOWrWQ-nA,signature=6xe5sVZcHtt2YZtnOBqyor98Tl0=,timestamp=1349383983, X-PAYPAL-DEVICE-IPADDRESS=127.0.0.1, X-PAYPAL-REQUEST-SOURCE=sdk-merchant-java-1.1.93, [email protected], X-PAYPAL-RESPONSE-DATA-FORMAT=NV}

Payload

requestEnvelope.errorLanguage=en_US&attributeList.attribute(0)=http://axschema.org/namePerson/first&attributeList.attribute(1)=http://axschema.org/namePerson/last&attributeList.attribute(2)=http://axschema.org/contact/email&attributeList.attribute(3)=http://schema.openid.net/contact/fullname&attributeList.attribute(4)=http://axschema.org/company/name&attributeList.attribute(5)=http://axschema.org/contact/country/home&attributeList.attribute(6)=https://www.paypal.com/webapps/auth/schema/payerID&

Response

responseEnvelope.timestamp=2012-10-04T13%3A54%3A51.690-07%3A00&responseEnvelope.ack=Failure&responseEnvelope.correlationId=e6ea99b5f3156&responseEnvelope.build=2210301&error(0).errorId=520003&error(0).domain=PLATFORM&error(0).subdomain=Application&error(0).severity=Error&error(0).category=Application&error(0).message=Authentication+failed.+API+credentials+are+incorrect.

Upvotes: 0

Views: 960

Answers (1)

Prasanna_PayPal
Prasanna_PayPal

Reputation: 902

We see that the header that is passed is incorrect in the junit test case and that should be the issue.

{X-PAYPAL-REQUEST-DATA-FORMAT=NV, X-PAYPAL-APPLICATION-ID=APP-80W284485P519543T, X-PP-AUTHORIZATION=token=uJvLxPmOCPVQbfVSxkH29I53Q6c5gd6XvY40ygCQxpbpOJOWrWQ-nA,signature=6xe5sVZcHtt2YZtnOBqyor98Tl0=,timestamp=1349383983, X-PAYPAL-DEVICE-IPADDRESS=127.0.0.1, X-PAYPAL-REQUEST-SOURCE=sdk-merchant-java-1.1.93, [email protected], X-PAYPAL-RESPONSE-DATA-FORMAT=NV}

Change X-PP-AUTHORIZATION to X-PAYPAL-AUTHORIZATION and that should resolve the issue for you. Please refer the header value that you had from the SDK.

Upvotes: 1

Related Questions