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

import_data does not work with Service Accounts due to missing project_id #110

Open
beheh opened this issue Jul 8, 2022 · 2 comments
Open

Comments

@beheh
Copy link

beheh commented Jul 8, 2022

While testing out service accounts, I kept getting Unauthorized, invalid project secret. See docs for more information: https://developer.mixpanel.com/reference/authentication#project-secret raised from the SDK

I ended up tracing this to the SDK never sending the project_id GET paramter to the import. This paramter is marked as required in the documentation.

Trying the following curl command:

curl --request POST \
  --url 'https://api.mixpanel.com/import?strict=1' \
  --header 'Accept: application/json' \
  --header 'Authorization: Basic <omitted>' \
  --header 'Content-Type: application/json' \
  --data '[{"event":"test"}]'

vs.

curl --request POST \
  --url 'https://api.mixpanel.com/import?strict=1&project_id=<omitted>' \
  --header 'Accept: application/json' \
  --header 'Authorization: Basic <omitted>' \
  --header 'Content-Type: application/json' \
  --data '[{"event":"test"}]'

...with credentials and with/without a project_id confirms the problem.

@beheh beheh changed the title Missing project_id parameter for import endpoint import_data does not work with Service Accounts due to missing project_id Jul 8, 2022
@beheh beheh changed the title import_data does not work with Service Accounts due to missing project_id import_data does not work with Service Accounts due to missing project_id Jul 8, 2022
@beheh
Copy link
Author

beheh commented Jul 8, 2022

In fact: service accounts seem unsupported entirely by this SDK. For example, it does not appear possible to supply a api_secret=<service_account>:<secret> to this SDK, due to the project_id omission and the fact that an additional colon is appended to that string as part of the HTTP Basic auth assembly.

@jaredmixpanel
Copy link
Contributor

@beheh that is correct, this SDK does not currently support Service Accounts. You can use Service Accounts to import data with our Python utilities library, though: https://github.com/mixpanel/mixpanel-utils

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