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

CommentFileSizeAuthor
getConfig_moves.patch11.71 KBfractile81

Comments

fractile81 created an issue. See original summary.

rosemaryreilman’s picture

Assigned: Unassigned » rosemaryreilman
Status: Active » Needs review

Taking a look, thanks for adding a patch

  • rosemaryreilman committed ed18a41b on 3.x
    Issue #3432136 by fractile81: Delay getConfig() Calls in ConstantContact...
rosemaryreilman’s picture

Status: Needs review » Patch (to be ported)

  • rosemaryreilman committed ed18a41b on 4.x
    Issue #3432136 by fractile81: Delay getConfig() Calls in ConstantContact...
rosemaryreilman’s picture

Status: Patch (to be ported) » Fixed
rosemaryreilman’s picture

Status: Fixed » Closed (fixed)