Sneezry / vscode-devto

https://marketplace.visualstudio.com/items?itemName=sneezry.vscode-devto
MIT License
15 stars 3 forks source link

Unexpected end of JSON input #10

Closed janegilring closed 2 years ago

janegilring commented 2 years ago

I get the error "Unexpected end of JSON input" when trying to sign in using an API key. Is this a known issue others can reproduce?

Sneezry commented 2 years ago

I cannot reproduce on my side. I created a new key for a test, and everything works fine.

What is the output of this command:

curl https://dev.to/api/articles/me/all?page=1 -H "User-Agent: vscode-devto;https://marketplace.visualstudio.com/items?itemName=sneezry.vscode-devto" -H "api-key: <your-api-key>"

You need replace <your-api-key> with your real key before execute it.

janegilring commented 2 years ago

Thanks for the quick reply.

The curl command seems to work fine:

curl https://dev.to/api/articles/me/all?page=1 -H "User-Agent: vscode-devto;https://marketplace.visualstudio.com/items?itemName=sneezry.vscode-devto" -H "api-key: eCeWGh9xxxxxxxgienjuT"
[{"type_of":"article","id":1156607,"title":"Introduction to Red Hat OpenShift Container Platform","description":"Introduction   Having worked with Kubernetes for some time, as well as Red Hat Enterprise...","published":true,"published_at":"2022-08-01T14:55:00.000Z","slug":"introduction-to-red-hat-openshift-container-platform-2a5d","path":"/janegilring/introduction-to-red-hat-openshift-container-platform-2a5d","url":"https://dev.to/janegilring/introduction-to-red-hat-openshift-container-platform-2a5d","comments_count":0,"public_reactions_count":3,"page_views_count":11,"published_timestamp":"2022-08-01T14:55:00Z","body_markdown":"\n# Introduction\n\nHaving worked with Kubernetes for some time, as well as Red Hat Enterprise Linux, I was eager to learn more about Red Hat's container product - Red Ha....

I tried again in VS Code, and without trying to sign in again - it was already authenticated and my articles show up.

Earlier today I tried from both a MacOS & a Windows machine - same error on both. Now, it works on both.

Maybe it was some temporary error on the server side. Anyway, I`m closing the issue.

Sneezry commented 2 years ago

@janegilring your API key is leaked in the above comment, you may need to revoke it.

janegilring commented 2 years ago

@janegilring your API key is leaked in the above comment, you may need to revoke it.

Thanks, but I replaced the middle part with "xxxxxx". Can do a revoke regardless to be on the safe side.

ApayRus commented 2 years ago

Hi! I have the same issue. curl answers with:

{"error":"unauthorized","status":401}

I see menu, can:

But I don't see any post in the left sidebar.

Sneezry commented 2 years ago

@ApayRus your key may be invalid. Generate a new one and have another try.

ApayRus commented 2 years ago

@ApayRus your key may be invalid. Generate a new one and have another try.

I did. It doesn't help.

Also key icon (Generate Key) button has link: https://dev.to/settings/account, but key generator is placed on https://dev.to/settings/extensions. Maybe you should fix it.

Sneezry commented 2 years ago

It has been fixed in the current code and will release in the next version. If you have a problem fetching data even with cURL command, you may need to seek help from DEV.to

ApayRus commented 2 years ago

If you have a problem fetching data even with cURL command, you may need to seek help from DEV.to

How? Should I write a post with this question?