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

Access Token support? #17

Open
jonton11 opened this issue Jan 10, 2017 · 4 comments
Open

Access Token support? #17

jonton11 opened this issue Jan 10, 2017 · 4 comments

Comments

@jonton11
Copy link

Does this API wrapper support using access tokens via OAuth for the api_key? I keep getting missing or invalid api key error when I attempt to.

@thorning
Copy link
Owner

It does not currently support that. I have not used the API with OAuth, and don't know what it takes to implement it.

I will be happy to accept a PR for it. It might be as easy as changing the constructor to accept an optional DC argument, as this is currently parsed from the api key.

@thorning
Copy link
Owner

thorning commented May 2, 2017

I added a issue for browser side support, and closing the related tasks

@thorning thorning closed this as completed May 2, 2017
@thorning
Copy link
Owner

Reopened, as relevant server side

@thorning thorning reopened this May 15, 2017
@ferrants
Copy link

ferrants commented Mar 6, 2018

See: https://developer.mailchimp.com/documentation/mailchimp/guides/how-to-use-oauth2/

The access_token is used as an API key. Users don’t have access to these keys because they are tied directly to your application. But, the user can de-authorize your application in MailChimp, which removes and invalidates the token.

If you GET /oauth2/metadata:

{"dc":"us1","login_url":"https:\/\/login.mailchimp.com","api_endpoint":"https:\/\/us1.api.mailchimp.com"}

And concatenate the accessToken and the datacenter, ${accessToken}-${dc}, you should be able to pass this right to mailchimp as the api key.

yharaskrik added a commit to yharaskrik/node-mailchimp that referenced this issue Dec 12, 2018
…_key or access_token to support basic HTTP Authentication or OAuth implementation as per Issue thorning#17. .request will now adjust the request made using whatever type of authentication is supplied in the constructor.
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

3 participants