Hi there,
I am trying to perform the token refresh operation (https://www.wikidata.org/wiki/Wikidata:REST_API/Authentication#Non-owner-onl...), but I get a 404:
curl --request POST \
--url https://www.wikidata.org/w/rest.php/w/rest.php/oauth2/access_token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data client_id=abc \
--data client_secret=xyz
{"messageTranslations":{"en":"The requested relative path (/w/rest.php/oauth2/access_token) did not match any known handler"},"httpCode":404,"httpReason":"Not Found"}%
Even with some invalid data for my client_id / client_Secret I would expect a different HTTP status telling me that the credentials are invalid etc.
Any idea what goes wrong?
Thanks and kind regards,
Tobias
Hi Tobias,
there has been a mistake/a bug in the example -- the URL included /w/rest.php twice, wrongly.
The URL part of curl request should rather be the following:
--url https://www.wikidata.org/w/rest.php/oauth2/access_token \
Hope that helps.
Peace
On Wed, 6 Sept 2023 at 07:52, Tobias Schweizer tobias.schweizer@switch.ch wrote:
Hi there,
I am trying to perform the token refresh operation ( https://www.wikidata.org/wiki/Wikidata:REST_API/Authentication#Non-owner-onl...), but I get a 404:
curl --request POST \
--url https://www.wikidata.org/w/rest.php/w/rest.php/oauth2/access_token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data client_id=abc \
--data client_secret=xyz
{"messageTranslations":{"en":"The requested relative path (/w/rest.php/oauth2/access_token) did not match any known handler"},"httpCode":404,"httpReason":"Not Found"}%
Even with some invalid data for my client_id / client_Secret I would expect a different HTTP status telling me that the credentials are invalid etc.
Any idea what goes wrong?
Thanks and kind regards,
Tobias _______________________________________________ Wikidata-tech mailing list -- wikidata-tech@lists.wikimedia.org To unsubscribe send an email to wikidata-tech-leave@lists.wikimedia.org
Hi Leszek,
I actually wondered about this, too 😊 It’s actually quite obvious, I should have seen it myself 😉
Now I am getting : {"error":"invalid_client","error_description":"Client authentication failed","message":"Client authentication failed"} which is the expected result for my bogus credentials 😊
I also tried with the actual credentials and got my new token back.
All good now.
Thanks!
Tobias
From: Leszek Manicki leszek.manicki@wikimedia.de Reply to: Wikidata technical discussion wikidata-tech@lists.wikimedia.org Date: Wednesday, 6 September 2023 at 08:39 To: Wikidata technical discussion wikidata-tech@lists.wikimedia.org Subject: [Wikidata-tech] Re: Auth: Refresh Token
Hi Tobias,
there has been a mistake/a bug in the example -- the URL included /w/rest.php twice, wrongly.
The URL part of curl request should rather be the following:
--url https://www.wikidata.org/w/rest.php/oauth2/access_token \
Hope that helps.
Peace
On Wed, 6 Sept 2023 at 07:52, Tobias Schweizer tobias.schweizer@switch.ch wrote:
Hi there,
I am trying to perform the token refresh operation (https://www.wikidata.org/wiki/Wikidata:REST_API/Authentication#Non-owner-onl...), but I get a 404:
curl --request POST \
--url https://www.wikidata.org/w/rest.php/w/rest.php/oauth2/access_token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data client_id=abc \
--data client_secret=xyz
{"messageTranslations":{"en":"The requested relative path (/w/rest.php/oauth2/access_token) did not match any known handler"},"httpCode":404,"httpReason":"Not Found"}%
Even with some invalid data for my client_id / client_Secret I would expect a different HTTP status telling me that the credentials are invalid etc.
Any idea what goes wrong?
Thanks and kind regards,
Tobias
_______________________________________________ Wikidata-tech mailing list -- wikidata-tech@lists.wikimedia.org To unsubscribe send an email to wikidata-tech-leave@lists.wikimedia.org
wikidata-tech@lists.wikimedia.org