asanghi / omniauth-constantcontact2

OmniAuth Strategy for Constant Contact using OAuth2
MIT License
5 stars 18 forks source link

Returns TypeError after Grant Access #1

Closed focorunner closed 12 years ago

focorunner commented 12 years ago

v1.0.2, returns TypeError when attempting to parse extra information if the Constant Contact account has multiple verified email addresses. After granting access, json posted to callback url is parsed into omniauth.env array, and if there is more than one set of values within the resulting entry array, "TypError: can't convert string to integer" is returned.

The code:

 info do
    {
        :email => raw_info['feed']['entry']['content']['Email']['EmailAddress']
    }
  end

in /omniauth-constantcontact2-1.0.2/lib/omniauth/strategies/constantcontact2.rb breaks at content if there is more than one block of content (more than one verified email addresses is returned) in json from constant contact.

There is also no indication I can find in the json posted to the callback to indicate which returned address is the default or account-holder address for the Constant Contact account. All of the verified email addresses should be parsed and stored for possible use in subsequent API calls.

asanghi commented 12 years ago

Released version v.1.03 which fixes this problem. We now return "email_entries" or "email" depending on whether one or more email addresses are returned.