Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The 7.x-2.x version of this module did not work for us out of the box. We kept getting a "Dashboard: Unauthorized" error message back from Elastic Email. Tried regenerating our API key, double-checked the email on the account, still no joy.
With a few tweaks to how the POST call to the Elastic Email API was made, I was able to get it working.
I will add a patch to this thread with the fixes that resolved our issue.
Comment | File | Size | Author |
---|---|---|---|
#2 | elastic_email-unauthorized_dashboard-2870430-12042281.patch | 2.36 KB | msupko |
Comments
Comment #2
msupko CreditAttribution: msupko as a volunteer commentedAttached is a patch that resolved our error authenticating with the Elastic Email V1 API.
The main changes are:
1. Include Content-Type: application/x-www-form-urlencoded header.
2. Switch to using drupal_http_request().
I'm sure the former method of fopen + stream_context_create() was working for many users, but it would not work for us. (We just opened our account in April 2017, so I'm guessing something is different about it from older accounts.)
Comment #3
mike.davis CreditAttribution: mike.davis at Deeson commentedHi @msupko,
Thanks for using this module.
The use of the context_stream was the original suggested way of making the API requests on the Elastic Email site when the module was first created. The patch looks fine from initial look through, but I'll have a look at this patch in more detail.
In the past 6 months or so Elastic Email have released their own set of classes for handling the API calls, which I have been integrating into the D8 release (which is in beta), so I will be looking at up dating the D7 version to use this as well, which should then work for you as well.
Thanks
Mike
Comment #4
mike.davis CreditAttribution: mike.davis at Deeson commentedComment #5
mike.davis CreditAttribution: mike.davis at Deeson commentedHi @msupko, I have tested this and this works fine, so I will get this committed now :)
Comment #7
mike.davis CreditAttribution: mike.davis at Deeson commentedThis has been committed now