Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credentials not being returned from Mailchimp #3

Closed
bgetting opened this issue Jun 11, 2012 · 6 comments
Closed

Credentials not being returned from Mailchimp #3

bgetting opened this issue Jun 11, 2012 · 6 comments

Comments

@bgetting
Copy link

When I follow the example for this strategy, there are no credentials returned in the omniauth.auth array:

auth = request.env["omniauth.auth"]

auth['credentials']['token']
#=> NoMethodError (undefined method `[]' for nil:NilClass)

auth['credentials']
#=> nil

auth['extra']['user_hash']['dc']
#=> NoMethodError (undefined method `[]' for nil:NilClass)

Any ideas? It does spit back all of the user data, which gives me the impression that it is getting a token back since it would need that to get at the user data, right?

Anyway, love that someone built a strategy for Mailchimp, and any help that you can provide in getting this working would be great. I've always connected directly using the Oauth2 gem, but I'm hoping that this will be easier.

Thanks.

@fmhun
Copy link
Owner

fmhun commented Jun 11, 2012

Sorry for that, i'll have a look as soon as possible.

Le 11 juin 2012 à 03:41, Brian Getting a écrit :

When I follow the example for this strategy, there are no credentials returned in the omniauth.auth array:

auth = request.env["omniauth.auth"]

auth['credentials']['token']
#=> NoMethodError (undefined method `[]' for nil:NilClass)

auth['credentials']
#=> nil

auth['extra']['user_hash']['dc']
#=> NoMethodError (undefined method `[]' for nil:NilClass)

Any ideas? It does spit back all of the user data, which gives me the impression that it is getting a token back since it would need that to get at the user data, right?

Anyway, love that someone built a strategy for Mailchimp, and any help that you can provide in getting this working would be great. I've always connected directly using the Oauth2 gem, but I'm hoping that this will be easier.

Thanks.


Reply to this email directly or view it on GitHub:
#3

@bgetting
Copy link
Author

That's awesome, I appreciate it. I'm hoping it's just something dumb that I am doing… :)

On Jun 11, 2012, at 12:35 AM, florian mhun wrote:

Sorry for that, i'll have a look as soon as possible.

@fmhun
Copy link
Owner

fmhun commented Jun 11, 2012

You are right there is a problem. I ran the example app with sinatra and get the undefined method exception too. I'll debug that, if you find something don't hesitate to keep me informed ;) Thank you very much for your mail Brian.

Le 11 juin 2012 à 18:44, Brian Getting a écrit :

That's awesome, I appreciate it. I'm hoping it's just something dumb that I am doing… :)

On Jun 11, 2012, at 12:35 AM, florian mhun wrote:

Sorry for that, i'll have a look as soon as possible.


Reply to this email directly or view it on GitHub:
#3 (comment)

@fmhun
Copy link
Owner

fmhun commented Jun 11, 2012

The json response returned by the MailChimp API not return user_hash key anymore, I fixed that. Check the commit to view the change, it works now.
338b582

Le 11 juin 2012 à 18:44, Brian Getting a écrit :

That's awesome, I appreciate it. I'm hoping it's just something dumb that I am doing… :)

On Jun 11, 2012, at 12:35 AM, florian mhun wrote:

Sorry for that, i'll have a look as soon as possible.


Reply to this email directly or view it on GitHub:
#3 (comment)

@bgetting
Copy link
Author

Are you seeing the credentials (specifically the token) being returned now?

On Jun 11, 2012, at 2:51 PM, florian mhun wrote:

The json response returned by the MailChimp API not return user_hash key anymore, I fixed that. Check the commit to view the change, it works now.
338b582

@fmhun
Copy link
Owner

fmhun commented Jun 12, 2012

Yes I do but a part of the token is located in metadata and you need to build it yourself. If you wan't to perform authenticated api calls on Mailchimp you need two things :

+ The oauth token : token = request.env['omniauth.auth']['credentials']['token']
+ The datacenter string : dc = request.env['omniauth.auth']['extra']['metadata']['dc']

Then, your real access token that you put to the authenticated api calls is token-dc as specified in the developer documentation http://apidocs.mailchimp.com/oauth2/#implementation-details

Let me know if i answer your question, my english may be hard to understand sometimes !

Le 12 juin 2012 à 00:12, Brian Getting a écrit :

Are you seeing the credentials (specifically the token) being returned now?

On Jun 11, 2012, at 2:51 PM, florian mhun wrote:

The json response returned by the MailChimp API not return user_hash key anymore, I fixed that. Check the commit to view the change, it works now.
338b582


Reply to this email directly or view it on GitHub:
#3 (comment)

@fmhun fmhun closed this as completed Jul 4, 2012
espen pushed a commit to espen/omniauth-mailchimp that referenced this issue Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants