Upcoming: API Key Sunset

Created on 9 September 2022, almost 2 years ago
Updated 27 March 2024, 3 months ago

Problem/Motivation

Hello,

I've recently had an email from Hubspot about the impending Hubspot API key sunset and was wondering how or if this would affect this module (We're currently using version 1 of the module alpha 6 on a Drupal 9 site)

Here's a copy of the email.

We're reaching out with a friendly reminder that the last day to request an extension for migrating integrations from using HubSpot API Keys to Private Apps is October 1, 2022.

 On June 1, 2022, we published a changelog update and Community blog post announcing an important change to API Keys. With this change, youโ€™ll need to migrate existing integrations from using HubSpot API Key authentication to Private Apps by November 30, 2022.

 API keys provide both read and write access to your HubSpot CRM data. This can be a security risk if these keys are compromised. By transitioning to private app access tokens, you can limit the data that integrations can request or change.

Requesting Extensions

We understand there may be scenarios where additional time is needed. If youโ€™d like to request an extension, please contact your customer success representative by October 1, 2022.

Our team will review and, depending on your situation, we may grant extended access to specific API keys on a temporary basis. If approved, the new deadline to complete migrations will be February 28, 2023. We are unable to offer further extensions beyond this date.

Resources

For more information, please review these Frequently Asked Questions and this migration guide, outlining step-by-step instructions on how to migrate API Key integrations to Private Apps. Over the next several months, weโ€™ll update these resources and send reminders along the way.

Thanks

Matt

โœจ Feature request
Status

Needs work

Version

3.0

Component

Code

Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom mattyb

Live updates comments and jobs are added and updated live.
  • API change

    Changes an existing API or subsystem. Not backportable to earlier major versions, unless absolutely required to fix a critical bug.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Merge request !7Issue #3308782: Upcoming: API Key Sunset โ†’ (Open) created by mmbk
  • ๐Ÿ‡ฌ๐Ÿ‡ง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 API

    2) 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 config

    3) 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_token

    Would be good for others using 1.x to review this. Wasn't sure whether to open another issue or not!

  • Status changed to RTBC over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States wstocker

    System settings:
    PHP 8.0.24
    Drupal core 9.5.3
    ddev version v1.21.3

    Installed 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 updbFires 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).

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States wstocker

    Changing status to "Needs work".

  • Status changed to RTBC over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธ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 8 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธ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 5 months ago
  • ๐Ÿ‡บ๐Ÿ‡ฆ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..

  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine buenos
  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine buenos

    Fixed TypeError.

  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine buenos

    + "psr/http-message": "^1.1 || ^2.0"

  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia naveenvalecha New Delhi

    Moving the version to 3.x

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia naveenvalecha New Delhi

    Here's the patch attached

  • ๐Ÿ‡จ๐Ÿ‡ฆ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 3 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia jannakha Brisbane!

    according to comment #20 - needs work

Production build 0.69.0 2024