- ๐ฌ๐งUnited Kingdom littlepixiez
Thanks for the patch @mmbk. I've used your changes as inspiration to apply the same changes to the 8.x-1.x branch, which is slightly different in that it uses V2 API and isn't loading external libraries. Similar approach:
1) .install
- Add requirements to check access_token is set
- Remove old config for client_id and client_secret and remove oauth access/refresh tokens from state API2) AdminSettings form
- Remove disconnect button and oauth submit functions
- Remove client_secret & client_id and replaced with access_token
- On submit, authorize the access_token and store it with the state API, not in config3) Hubspot API service
- Changed authorize function to check access token and compare the portal ID to ensure it's correct. If not, it removes the access_token in state
- Removed oauth retry for refresh token
- Changed isConfigured to check for access_tokenWould be good for others using 1.x to review this. Wasn't sure whether to open another issue or not!
- Status changed to RTBC
almost 2 years ago 9:40pm 8 February 2023 - ๐บ๐ธUnited States wstocker
System settings:
PHP 8.0.24
Drupal core 9.5.3
ddev version v1.21.3Installed patch and cannot connect. Message is "Cannot connect to hubspot API."
Steps to reproduce:
- Require dev constraint in composer.json
"drupal/hubspot": "dev-3308782-private-app as 3308782"
- Include the repository in composer.json:
"https://git.drupalcode.org/issue/hubspot-3308782.git"
composer update to install patch
- Run
drush updb
Fires hook obsolete API settings. Implements hook_update_N(). - After obtaining the access token from hubspot API paste in access token field and save
Response error message:
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `GET https://api.hubapi.com/integrations/v1/me` resulted in a `401 Unauthorized` response: {"status":"error","message":"Authentication credentials not found. This API supports both API Key and OAuth 2.0 authenti (truncated...) in SevenShores\Hubspot\Exceptions\HubspotException::create() (line 24 of /var/www/html/vendor/hubspot/hubspot-php/src/Exceptions/HubspotException.php).
- Require dev constraint in composer.json
- Status changed to Needs work
almost 2 years ago 9:52pm 8 February 2023 - Status changed to RTBC
almost 2 years ago 4:48pm 15 February 2023 - ๐บ๐ธUnited States wstocker
Turns out I created the app in the wrong place on the Hubspot side. Once I created the app under "Private Apps" I was able to connect successfully with the access token it generated.
Changing the status to "Reviews and tested by the community".
- ๐บ๐ธUnited States SiliconValet
#5 Patch wasn't applying for me on 3.0.0-alpha2. Re-rolled patch based on merge request provided by @mmbk.
- Status changed to Needs work
about 1 year ago 8:42am 27 October 2023 - ๐บ๐ธUnited States SocialNicheGuru
Does not apply to alpha4.
composer install fails:
https://www.drupal.org/files/issues/2023-03-20/upcoming-api-key-sunset--... โ (Upcoming: API Key Sunset - https://www.drupal.org/project/hubspot/issues/3308782 ๐ Upcoming: API Key Sunset Needs work )
Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2023-03-20/upcoming-api-key-sunset--... โIs it needed?
The release notes for the release states: This release resolves an issue with the hubspot api.If it no longer applies, but does for other releasees let's note that.
- ๐บ๐ธUnited States danflanagan8 St. Louis, US
I don't think the Hubspot API change affects this module. This module uses OAuth, which is still supported: https://developers.hubspot.com/docs/api/working-with-oauth#initiating-an...
We store the client ID and the client secret in config.
The technique that was sunset used a single API key to authenticate.
- Status changed to Needs review
9 months ago 5:50pm 8 February 2024 - ๐บ๐ฆUkraine buenos
An attempt (not sure if relevant for anybody) to be able to switch between Public (Client ID + Client Secret) and Private (Access Token) App integrations.
+ switched hubspot/hubspot-php library to version 5.2.
+ Included fix from this issue ๐ Fatal error trying to add HubSpot handler in webform RTBC . - ๐บ๐ฆUkraine buenos
Sorry, UPD to #12 - patch should be based against version 3.0.0-alpha4 rather than 3.x, attaching updated one..
- First commit to issue fork.
- ๐จ๐ฆCanada davemybes Montreal
With the patch in #19, I'm seeing a fatal error when saving the settings page:
Fatal error: Declaration of SevenShores\Hubspot\Http\Response::getStatusCode() must be compatible with Psr\Http\Message\ResponseInterface::getStatusCode(): int in vendor/hubspot/hubspot-php/src/Http/Response.php on line 326
I'm assuming this is because the hubspot-php library is still 3.2.1?
For #16, I couldn't save the page, because the Client ID & Secret fields are required. If I changed them to not required in the module code, the page saves, but gives an error:
Uncaught PHP Exception Error: "Call to undefined method SevenShores\\Hubspot\\Factory::createWithAccessToken()" at /modules/contrib/hubspot/src/Form/AdminSettings.php line 261
This is also probably due to the old php library. When I use composer to pull the module and patch it, that library does not get updated. If there's a way to make that happen after the patch, let me know how, please. - Status changed to Needs work
8 months ago 12:09pm 27 March 2024 - Status changed to Needs review
4 months ago 9:21am 26 July 2024 - ๐ฌ๐งUnited Kingdom 3li U.K. ๐ฌ๐ง
I found that #16 does work, but due to the limitations of patches you cannot apply changes to composer.json to say install/update another modules requirements - https://docs.cweagans.net/composer-patches/troubleshooting/non-patchable...
I have made some changes to #16 to allow the fields to be empty and should not cause any issues.
Steps to apply:
- Install hubspot module 3.x:
composer require 'drupal/hubspot:3.x-dev@dev'
- Alter composer.lock hubspot-php requirement:
From:
"require": { "drupal/core": "^8.9 || ^9 || ^10", "drupal/webform": "*", "hubspot/hubspot-php": "^3.0" },
To:
"require": { "drupal/core": "^8.9 || ^9 || ^10", "drupal/webform": "*", "hubspot/hubspot-php": "^5.2" },
- Install hubspot-php 5.2:
composer require hubspot/hubspot-php:^5.2 -W
- Apply patch #16/#22
- Install hubspot module 3.x: