RecurlyPushListenerController Recurly_UnauthorizedError

Created on 10 August 2023, over 1 year ago
Updated 1 November 2023, about 1 year ago

Problem/Motivation

Recurly_UnauthorizedError: Your API Key is not authorized to connect to Recurly. in Recurly_ClientResponse->validateStatusCode() (line 21 of /code/vendor/recurly/recurly-client/lib/recurly/util/http_validations.php).

Returning when the listener endpoint receives the notification type of ['new_account_notification', 'new_subscription_notification', 'canceled_account_notification', 'reactivated_account_notification', 'billing_info_updated_notification']. This is because the line $recurly_account = \Recurly_Account::get($notification->account->account_code); did not pass the Recurly client instance. Forcing Recurly_Client to create a new instance, with the default API Keys, subdomain, etc. Resulting in the unauthorized error.

Steps to reproduce

Log into your Recurly.com account and visit the API Credentials page at /developer/api_keys. Copy the value for the Private API Key and subdomain (found in the address bar or configuration/edit) & paste them into the module configuration in Drupal under /admin/config/services/recurly. If you are using recurlyjs, you will also need the Public Key.

While on the Recurly settings page in Drupal, copy the full URL from the description of the "Listener URL key" field. It should be something like: https://example.com/recurly/listener/QVDtH2CR. Use an HTTPS URL if available. Take this full URL and paste it into the Recurly.com settings for "Webhook URL" - Developers > Webhooks (configuration/notifications/configure).

Proposed resolution

Pass the $this->recurlyClient instance in the \Recurly_Account::get() on RecurlyPushListenerController.php

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Closed: duplicate

Version

4.0

Component

Code

Created by

πŸ‡΅πŸ‡­Philippines Renzokuken1

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

Comments & Activities

Production build 0.71.5 2024