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

curl syntax to verify application token #652

Closed
4 of 6 tasks
cmonty14 opened this issue May 14, 2024 · 3 comments
Closed
4 of 6 tasks

curl syntax to verify application token #652

cmonty14 opened this issue May 14, 2024 · 3 comments
Labels
question Further information is requested

Comments

@cmonty14
Copy link

cmonty14 commented May 14, 2024

Have you read the documentation?

  • Yes, but it does not include related information regarding my question.
  • Yes, but the steps described in the documentation do not work on my machine.
  • Yes, but I am having difficulty understanding it and want clarification.

You are setting up gotify in

  • Docker
  • Linux native platform
  • Windows native platform

Describe your problem
I have defined an application in Gotify.
How can I verify using curl syntax if the token is working correctly fetching data via API?

Any errors, logs, or other information that might help us identify your problem
Running this command
curl -L -k -H 'X-Gotify-Key:ASaG-yml6So3yx-' http://gotify.example.com:8680/client
or
curl -L -k "http://gotify.example.com:8680/client?token=ASaG-yml6So3yx-"
fails with error:
{"error":"Unauthorized","errorCode":401,"errorDescription":"you need to provide a valid access token or user credentials to access this api"}

@cmonty14 cmonty14 added the question Further information is requested label May 14, 2024
@jmattheis
Copy link
Member

Application are only allowed to POST to /message, any other api gives 401. You can do this request:

$ curl -X POST 'http://localhost:8080/message' -H 'Authorization: bearer ACZPatHGzL-z3i9'

if it returns 401 the token is invalid, if it's 400 it's a valid token.

@cmonty14
Copy link
Author

Running this command
curl -X POST "http://gotify.example.com:8680/message?token=ASaG-yml6So3yx-" -F "title=notification" -F "message=message from terminal"
is working as expected:
{"id":2,"appid":3,"message":"message from terminal","title":"notification","priority":1,"date":"2024-05-14T14:59:10.475177001+02:00"}

@jmattheis
Copy link
Member

Okay, then there is no problem anymore?

@jmattheis jmattheis closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Development

No branches or pull requests

2 participants