Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

How to pass an access token into ApiContext? #1342

Open
sergeyMarkov opened this issue Feb 20, 2020 · 0 comments
Open

How to pass an access token into ApiContext? #1342

sergeyMarkov opened this issue Feb 20, 2020 · 0 comments

Comments

@sergeyMarkov
Copy link

Referencing to https://developer.paypal.com/docs/api/get-an-access-token-curl/ PayPal advices to re-use the access token until it expires and then get/generate a new token.

To reduce the number of requests (especially during the high load on the website) I would like to implement the usage of access token, but there are no examples how to implement it.

In other words -- $apiContext is usually generated based on the creation of new OAuthTokenCredential() object

$apiContext = new \PayPal\Rest\ApiContext(
  new \PayPal\Auth\OAuthTokenCredential(
    'YOUR APPLICATION CLIENT ID',
    'YOUR APPLICATION CLIENT SECRET'
  )
);

Question - How to create $apiContext having already pre-generated access token?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant