customerio / cio-sdk-tools

A self service tool to run diagnostics on your mobile SDK installation
MIT License
2 stars 0 forks source link

CIO Tools command unauthorized #27

Closed nicholas-patterson closed 6 months ago

nicholas-patterson commented 6 months ago

I am trying to use this command npx cio-sdk-tools@latest send-push --api-key API_KEY --token DEVICE_TOKEN --platform DEVICE_PLATFORM

I get this response {"timestamp":"2024-01-24T16:40:32.294Z","level":"error","message":"could not send push","errors":[{"detail":"unauthorized","status":"401"}]}

In the workspace we have track api keys (which contains siteId and api key) and there is a APP Api key section that contains and app api key. Does it make a difference which api key is being used here. Am I supposed to be using one or the other?

levibostian commented 6 months ago

Hey there. Sorry to hear you're having an issue using the tool. Let me see if I can help.

Before I answer your questions, may I ask, are you running this exact command on your machine:

 npx cio-sdk-tools@latest send-push --api-key API_KEY --token DEVICE_TOKEN --platform DEVICE_PLATFORM

Or, are you replacing the placeholders with real values such as:

 npx cio-sdk-tools@latest send-push --api-key "your-app-api-key-here" --token "your-device-token-goes-here" --platform "ios"

Does it make a difference which api key is being used here

APP Api keys do have restrictions on them. I suggest double-checking the settings for your key to see what workspace it works on and if IP whitelisting is enabled or disabled.

nicholas-patterson commented 6 months ago

I am running the command with the real values. Right now I am using the track api key and I am getting unauthorized.

levibostian commented 6 months ago

Oh, my apologies. Now I understand your question.

Yes, there is a difference between using the track api key and an app api key.

For using the send-push command, an app api key is required. You can visit https://fly.customer.io/settings/api_credentials?keyType=app to get your API key.

levibostian commented 6 months ago

I can see how this is not clear in the README.

I'll make a change to the doc to make this more clear.

nicholas-patterson commented 6 months ago

Thanks! that is working. I have another customer.io related issue with images not working. Is there a way I can reach out to you?

levibostian commented 6 months ago

Glad to hear that helped!

I suggest sending a message to win@customer.io about your images issue. Even beyond images, you're always welcome to send any question you have there. You will receive the best help there.

I'll close this issue since your having success. Have an awesome day!