Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make request does not check if token is expired in v1.1.1 #71

Closed
josephdpurcell opened this issue Jun 1, 2020 · 3 comments
Closed

Make request does not check if token is expired in v1.1.1 #71

josephdpurcell opened this issue Jun 1, 2020 · 3 comments

Comments

@josephdpurcell
Copy link

josephdpurcell commented Jun 1, 2020

Describe the bug
The makeRequest() method on src/CloudApi/Connector.php does not check if the access token has expired.

To Reproduce

  1. In a long running process, setup an access token
  2. Call makeRequest()
  3. Wait 5 minutes
  4. Call makeRequest() again
  5. Notice an exception is thrown with a 403 Forbidden response from the API:
{
    "error": "unauthorized",
    "message": "The access token has expired."
}

Expected behavior
When a request is made the second time, a check is made if the token is expired. If it is expired, get a new one.

Screenshots
NA

Desktop (please complete the following information):

  • OS: Ubuntu
  • Code version/tag: 1.1.1

Additional context
#48 seems related.

This issue is fixed in the latest, see: https://github.com/typhonius/acquia-php-sdk-v2/blob/master/src/Connector/Connector.php#L59

This issue will be expired currently by anyone using https://github.com/lcatlett/blt-drush-alias/blob/master/composer.json#L15 because it locks this library to v1.

@josephdpurcell
Copy link
Author

josephdpurcell commented Jun 1, 2020

THIS IS NO LONGER NEEDED

If you need to solve this issue and you can't wait for v1 to be hotfixed, and you can't use v2, you can solve this with the attached patch:

71-check-access-token.patch.txt

And adding this to your composer.json:

    "patches": {
            "typhonius/acquia-php-sdk-v2": {
                "Check access token #71": "patches/71-check-access-token.patch.txt"
            }

@typhonius
Copy link
Owner

Thanks for this and the PR. As it's nowhere near breaking an API and constitutes an issue that I'm sure others will face I've rolled it in and will tag 1.1.2 on this branch.

@josephdpurcell
Copy link
Author

This is great!

Now, to take advantage of this if you're on 1x of this repo is to do:

composer update typhonius/acquia-php-sdk-v2

Thank you for a swift update!

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

No branches or pull requests

2 participants