Delay getConfig() Calls in ConstantContact.php

Created on 19 March 2024, 9 months ago
Updated 19 September 2024, 3 months ago

Problem/Motivation

There are numerous instances of getConfig() being called before token refreshes and hook calls in the ConstantContact.php file/service. For example, this ordering causes a problem when refreshToken() is called, and new tokens are generated and stored. In this state any subsequent HTTP request is made using the old/expired tokens.

Steps to reproduce

1. Setup CC and get the access and refresh tokens working in Drupal.
2. Visit the Lists page.
3. Check the log for "grant" errors.

Proposed resolution

Move all getConfig() calls to be as close to the HTTP request as possible. In cases when configs are needed sooner, re-pull the config before the HTTP request. Doing it this way instead of incorporating getTokens() since other config values may be changed. The provided patch does this.

Remaining tasks

Review and apply the patch.

User interface changes

n/a

API changes

Consumption of the CC API is updated to use the most recent tokens possible.

Data model changes

n/a

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States fractile81

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024