Get an access token fails
ravi_kits
New Community Member
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Nov-30-2018
01:01 PM
I am new to PayPal integration. I have obtained clientID and secret key for sandbox.
I trying to integrate PayPal.
As per https://developer.paypal.com/docs/api/overview/#make-your-first-call , I need to get access token. I followed the recommended curl command but it is failing.
Here is the command I used:
curl -v https://api.sandbox.paypal.com/v1/oauth2/token -H "Accept: application/json" -H "Accept-Language: en_US" -u "Aa-nm6-dTYkBCBf5n0G1Pd5eo95qEIUUKAgOw_-rYfDULeM4Ibka2tqR4gRs2UTztW-e8SBKnUlBI8Qw:EF75tYkFIijVR6zCPXH--nGn_gZYfaHpTMZt0r-7_xLf-TVNscD2PFBIBH3eAnaIBciB8qwK0TPakEUM" -d "grant_type=client_credentials"
Here is the response I get:
[root@wam2net ~]# curl -v https://api.sandbox.paypal.com/v1/oauth2/token * About to connect() to api.sandbox.paypal.com port 443 (#0) * Trying 173.0.82.78... * Connected to api.sandbox.paypal.com (173.0.82.78) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * NSS: client certificate not found (nickname not specified) * SSL connection using TLS_RSA_WITH_AES_256_CBC_SHA256 * Server certificate: * subject: CN=api.sandbox.paypal.com,OU=PayPal Production,O="PayPal, Inc.",L=San Jose,ST=California,C=US * start date: Aug 21 00:00:00 2018 GMT * expire date: Aug 20 12:00:00 2020 GMT * common name: api.sandbox.paypal.com * issuer: CN=DigiCert Global CA G2,O=DigiCert Inc,C=US > GET /v1/oauth2/token HTTP/1.1 > User-Agent: curl/7.29.0 > Host: api.sandbox.paypal.com > Accept: */* > < HTTP/1.1 401 Unauthorized < Date: Fri, 30 Nov 2018 20:57:08 GMT < Server: Apache < paypal-debug-id: fc8efa2188b3b < HTTP_X_PP_AZ_LOCATOR: sandbox.slc < Paypal-Debug-Id: fc8efa2188b3b < Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D1880%26app%3Dapiplatformproxyserv%26TIME%3D614728028%26HTTP_X_PP_AZ_LOCATOR%3Dsandbox.slc; Expires=Fri, 30 Nov 2018 21:27:08 GMT; domain=.paypal.com; path=/; Secure; HttpOnly < Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT < Content-Length: 244 < Connection: close < Content-Type: application/json < * Closing connection 0 {"name":"AUTHENTICATION_FAILURE","message":"Authentication failed due to invalid authentication credentials or a missing Authorization header.","links":[{"href":"https://developer.paypal.com/docs/api/overview/#error","rel":"information_link"}]}[root@wam2net ~]# -H "Accept: application/json" bash: -H: command not found... [root@wam2net ~]# -H "Accept-Language: en_US" bash: -H: command not found... [root@wam2net ~]# -u "Aa-nm6-dTYkBCBf5n0G1Pd5eo95qEIUUKAgOw_-rYfDULeM4Ibka2tqR4gRs2UTztW-e8SBKnUlBI8Qw:EF75tYkFIijVR6zCPXH--nGn_gZYfaHpTMZt0r-7_xLf-TVNscD2PFBIBH3eAnaIBciB8qwK0TPakEUM" bash: -u: command not found... [root@wam2net ~]# -d "grant_type=client_credentials" bash: -d: command not found... [root@wam2net ~]# [root@wam2net ~]#
I see one issue in the response. Not sure if that is the issue.
NSS: client certificate not found (nickname not specified)
Can someone suggest how to fix the command and get the response token?
Thanks.
Labels:
Login to Me Too
- Labels:
-
Payments REST APIs
-
Payouts Rest APIs
1 REPLY 1
robinpearse
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr-05-2019
02:46 PM
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Refunding an order via HATEOAS URL failing with NOT_AUTHORIZED error in Sandbox Environment
- How to retrieve merchant integration status through the API? in REST APIs
- I Have PayPal API Billing Authentication Failure Python-Flask in REST APIs
- Need Help Upgrading to PayPal complete payments in PayPal Upgrade Community
- Getting Not Authorized on API Call in REST APIs