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-only_clients), 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



--

Leszek Manicki
Engineering Manager

Wikimedia Deutschland e. V. | Tempelhofer Ufer 23-24 | 10963 Berlin
Phone: +49 (0)30-577 11 62-0
https://wikimedia.de

Keep up to date! Current news and exciting stories about Wikimedia, Wikipedia and Free Knowledge in our newsletter (in German): Subscribe now.

Imagine a world in which every single human being can freely share in the sum of all knowledge. Help us to achieve our vision!

https://spenden.wikimedia.de

 

Imagine a world in which every single human being can freely share in the sum of all knowledge. Help us to achieve our vision!

https://spenden.wikimedia.de
Wikimedia Deutschland — Gesellschaft zur Förderung Freien Wissens e. V. Eingetragen im Vereinsregister des Amtsgerichts Charlottenburg, VR 23855 B. Als gemeinnützig anerkannt durch das Finanzamt für Körperschaften I Berlin, Steuernummer 27/029/42207. Geschäftsführende Vorstände: Franziska Heine, Dr. Christian Humborg