La signature OAuth ne correspond pas
-
-
mettre desguillemets simples autour des valeurs de $ signatureet $ consumer_signatureput single quotation marks around the values for $signature and $consumer_signature
- 0
- 2015-04-27
- user42826
-
désolé,en fait,je les aijustemispour référenceet non comme code.ces valeurs sont calculéesmais les algorithmes dans les clientsjavascriptet côté serveursorry I actually I just put them for reference not as code. these values are calculated but algorithms in javascript clients and server side
- 0
- 2015-04-27
- Sudarshan Anbazhagan
-
4 réponses
- votes
-
- 2015-09-07
J'étais confronté à unproblème similaireen essayant d'utiliser Client-CLI avec leplugin OAuth 1.0a,maisj'aitrouvé une solution ici sur le dépôt officiel.
Dans lefichier
lib/class-wp-json-authentication-oauth1.php
sur la ligne524
,modifiez le code suivant:$base_request_uri = rawurlencode( get_home_url( null, parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ), 'http' ) );
à:
$home_url_path = parse_url(get_home_url (null,'','http'), PHP_URL_PATH ); $request_uri_path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); if (substr($request_uri_path, 0, strlen($home_url_path)) == $home_url_path) { $request_uri_path = substr($request_uri_path, strlen($home_url_path)); } $base_request_uri = rawurlencode( get_home_url( null, $request_uri_path, 'http' ) );
Cela devrait résoudre leproblème auquel vous êtes confronté.
I was facing a similar issue when trying to use Client-CLI with OAuth 1.0a plugin, however I found a solution here on the official repository.
In the file
lib/class-wp-json-authentication-oauth1.php
on line524
, change the following code:$base_request_uri = rawurlencode( get_home_url( null, parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ), 'http' ) );
to:
$home_url_path = parse_url(get_home_url (null,'','http'), PHP_URL_PATH ); $request_uri_path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); if (substr($request_uri_path, 0, strlen($home_url_path)) == $home_url_path) { $request_uri_path = substr($request_uri_path, strlen($home_url_path)); } $base_request_uri = rawurlencode( get_home_url( null, $request_uri_path, 'http' ) );
This should solve the problem you are facing.
-
Pourriez-vousexpliquer comment celafonctionneexactement?Qu'est ce qui a changé?Jene connaispas PHPmaisje rencontre lemêmeproblème avec un clientjavascript quej'écriset jepense que votre solutionpourraitpeut-être segénéraliser àmon application.Would you mind expanding on how this works exactly? What changed? I don't know PHP but I'm running into the same issue with a javascript client I'm writing, and I think perhaps your solution might generalize to my app.
- 0
- 2016-06-24
- Chuck Dries
-
- 2016-07-12
Assurez-vous que la demande de signatureesttraitée correctement: http://oauth1.wp-api.org/docs/basics/Signing.html
Si vous utilisez POSTMAN,vouspouvez le définir sur OAuth 1.0 sous Autorisation,puis sélectionner les options
- Ajouter desparamètres vides à la signature
- Encoder la signature OAuth
- Enregistrer les données d'aide à la demande
Voici untutoriel détaillé quej'ai écrit sur l'utilisation d'OAuth 1et de Postman avec WordPress: https://wordpress.stackexchange.com/a/239873/51201
Make sure that signature request is handled correctly: http://oauth1.wp-api.org/docs/basics/Signing.html
If you're using POSTMAN you can set it to OAuth 1.0 under Authorization and then select the options
- Add empty params to signature
- Encode OAuth signature
- Save helper data to request
Here's a detailed tutorial I wrote on using OAuth 1 and Postman with WordPress: https://wordpress.stackexchange.com/a/239873/51201
-
"Ajouter desparamètres vides à la signature" afonctionnépourmoi.Jene comprendspas vraiment la raison derrière cela."Add empty params to signature" worked for me. I don't really understand the reason behind it.
- 0
- 2016-11-01
- Loc Pham
-
@LocPham c'estparce que la signatureestgénérée àpartir des arguments de la requête,vous devez doncinclure des arguments videspour qu'ellegénère correctement la signature@LocPham it's because the signature is generated from the query arguments, thus, you need to have empty arguments included to have it generate the signature correctly
- 0
- 2016-11-02
- sMyles
-
J'ai desproblèmespourinstalleret activer desplugins avec wordpress 4.9.6.voulez-vous vérifier ceci: https://wordpress.stackexchange.com/q/300120/141031I have problem in installing and activating plugins with wordpress 4.9.6. would you check this: https://wordpress.stackexchange.com/q/300120/141031
- 0
- 2018-04-08
- Mahdi
-
- 2017-02-09
Dans Postman,sous Autorisation ,essayez de désélectionner " Ajouter desparamètres à l'en-tête ".
In Postman under Authorization try deselecting "Add params to header".
-
Jene saispaspourquoi cela a été rejeté,afonctionnépourmoi ...not sure why this got downvoted, worked for me...
- 0
- 2018-03-23
- Splatbang
-
J'aitravailléici aussi!Worked here too!
- 0
- 2019-09-25
- Chris Nevill
-
- 2017-06-20
vérifiez votretransfertbaseurl. Dansmon cas,lenon-www étaittransmis à www.Après avoirmis àjour lebaseurl auformat www.example.com,cela afonctionnépourmoi.
check you baseurl forwarding. In my case the non-www was being forwarded to www. After updating the baseurl to www.example.com format it worked for me.
J'utilise ce qui suit dansmon wordpresspour développer une applicationbasée sur oauth.
WP-API (plugin degénération d'api)
WP API OAuth1 (serveur oauth)et
WP API client-cli (bibliothèque cliente oauth)
à l'url ci-dessousestpour le client wp-cli https://man-sudarshann-1.c9.io/api/
J'obtiens cetteerreur La signature OAuthne correspondpas lorsqueje clique sur lebouton AUTHpour authentifier la demande. J'aiessayétous les correctifspour cela sur Internet.mais aucunn'a aidé
La signaturegénéréeet envoyéepar le client apiest 3ko8DUsUUEB4Hqaks68vGYnTjQM=
La signaturegénérée côté serveurest 5rPsul6zplhfNvb4o+Mz11O/OyI=
donc le code ci-dessous échoue
Je suppose que la console APIgénère unemauvaise signature. Veuillezm'aider à résoudre ceproblème.