Getting Paypal access token from a refresh token

Okan Kocyigit

When I try to get access_token from refresh token via cURL or postman getting response successfully,

REQUEST

POST /v1/oauth2/token HTTP/1.1
Host: api.sandbox.paypal.com
Content-Type: application/x-www-form-urlencoded
Authorization: Basic QVZZeWdRa2dSX3pScmtJT25PZXVz.....
Cache-Control: no-cache

grant_type=refresh_token&refresh_token=-Q1_6fEwUDQ0ci0CJIA......

RESULT

{
"scope":"phone https://uri.paypal.com/services/subscriptions https://api.paypal.com/v1/payments/.* address email https://api.paypal.com/v1/vault/credit-card https://uri.paypal.com/services/applications/webhooks https://uri.paypal.com/services/payments/futurepayments openid https://api.paypal.com/v1/vault/credit-card/.*","nonce":"2016-11-08T13:58:45Zm5eDiRGyJIDC9EwX7DRl6aB7IPlRl-cjoS_E3Ro8sCo",
"access_token":"A103.CfI6WQaDmEqrQ.....",
"token_type":"Bearer",
"app_id":"APP-80W28448....",
"expires_in":28796
}

But when I do the same thing with paypal-net sdk like this,

var apiContext = PaypalConfiguration.GetAPIContext();
var tokenInfo = new Tokeninfo();
tokenInfo.refresh_token = "-Q1_6fEwUDQ0ci0CJIA7BtG_Ey4i....";
var refreshTokenParams = new CreateFromRefreshTokenParameters();
var token = tokenInfo.CreateFromRefreshToken(apiContext, refreshTokenParams);

I keep getting this response,

{
"error_description":"POST /v1/oauth2/token returned a response status of 400 Bad Request",
"error":"400",
"correlation_id":"46ecefc761f3f",
"information_link":"https://developer.paypal.com/docs/api/#errors"
}

my mode is set as sandbox, client id and client secret are right for sandbox.

Could you please tell me where I am wrong or are there something wrong with Paypal-NET-SDK?

Okan Kocyigit

There was a bug which has been fixed.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Getting access token from the PayPal API Error

Get access token from refresh token in Volley

Google OAuth getting new access token with refresh token

How to use refresh token to get authorized in background and getting access token?

Getting access token from refresh token failing with invalid_grant error, and Bad Request OR Token has been expired or revoked as error description

Access Token and Refresh Token flow

How to get access token from PayPal in MVC

Swift Alamofire Getting Token from Refresh Token Request Error

Not Getting a refresh_token

Get Access Token from Refresh Token using cURL

Receiving access token but not the refresh token from Microsoft Graph API

Get Access Token from Refresh Token using cURL Google API

Current method to get new access token from refresh token

GoogleWebAuthorizationBroker does not automatically return new access token from refresh token

how to refresh access token with refresh token?

getting access token from sound cloud?

Getting Access token from GooglePlus Sign in

Getting refresh token each time

Not getting refresh token in youtube OAuth

Fitbit integration not getting refresh token

OAuth access token and refresh token creation

JWT access token vs refresh token (creating)

Access Token vs Refresh Token NodeJS

How to renew the access token using the refresh token?

Unable to get Access token and Refresh token

How to exchange an refresh token for an access token .

Getting access token with axios

is refresh the refresh token and refresh the access token pass the same parameter

Getting a new refresh token when using one to get an access token dropbox v2 api