La firma OAuth non corrisponde
-
-
inserire virgolette singole attorno ai valori di $ signaturee $ consumer_signatureput single quotation marks around the values for $signature and $consumer_signature
- 0
- 2015-04-27
- user42826
-
scusain realtà li ho solomessi come riferimentonon come codice.questi valori sono calcolatima algoritminei clientjavascripte lato serversorry 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 risposta
- voti
-
- 2015-09-07
Stavo affrontando unproblema simile duranteiltentativo di utilizzare Client-CLI conilplug-in OAuth 1.0a,tuttavia hotrovato una soluzione qui nel repository ufficiale.
Nelfile
lib/class-wp-json-authentication-oauth1.php
sulla riga524
,modificail seguente codice:$base_request_uri = rawurlencode( get_home_url( null, parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ), 'http' ) );
a:
$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' ) );
Questo dovrebbe risolvereilproblema che stai affrontando.
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.
-
Ti dispiacerebbe approfondire comefunzionaesattamente?Cosa è cambiato?Non conosco PHPma sto riscontrando lo stessoproblema con un clientjavascript che sto scrivendoe penso cheforse latua soluzionepotrebbeesseregeneralizzata allamia app.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
Assicurati che la richiesta difirma siagestita correttamente: http://oauth1.wp-api.org/docs/basics/Signing.html
Se stai utilizzando POSTMANpuoiimpostarlo su OAuth 1.0in Autorizzazionee quindi selezionare le opzioni
- Aggiungiparametri vuoti allafirma
- Codificafirma OAuth
- Salvai dati dell'helper su richiesta
Ecco untutorial dettagliato che ho scritto sull'utilizzo di OAuth 1e Postman con 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
-
"Aggiungiparametri vuoti allafirma" hafunzionatoperme.Nonne capisco davveroilmotivo."Add empty params to signature" worked for me. I don't really understand the reason behind it.
- 0
- 2016-11-01
- Loc Pham
-
@LocPham èperché lafirma vienegenerata dagli argomenti della query,quindi,ènecessarioincludere argomenti vuotiperfar sì chegeneri correttamente lafirma@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
-
Hoproblemi con l'installazionee l'attivazione diplugin con wordpress 4.9.6.controlleresti questo: 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
In Postmanin Autorizzazione prova a deselezionare " Aggiungiparametri all'intestazione ".
In Postman under Authorization try deselecting "Add params to header".
-
non sono sicuro delmotivoper cui questo è stato svalutato,hafunzionatoperme ...not sure why this got downvoted, worked for me...
- 0
- 2018-03-23
- Splatbang
-
Ha lavorato anche qui!Worked here too!
- 0
- 2019-09-25
- Chris Nevill
-
- 2017-06-20
controlla l'inoltro dibaseurl. Nelmio casoilnon-www è statoinoltrato a www.Dopo aver aggiornatoilformatobaseurl alformato www.example.com,hafunzionatoperme.
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.
Sto usando quanto seguenelmio wordpressper sviluppare un'applicazionebasata su oauth.
WP-API (pluginper lagenerazione di API)
WP API OAuth1 (server oauth)e
Client-cli dell'API WP (libreria client oauth)
all'URL sottostante èperil client-cli di wp https://man-sudarshann-1.c9.io/api/
Ricevo questoerrore Lafirma OAuthnon corrisponde quandofaccio clic sulpulsante AUTHper autorizzare la richiesta. Hoprovatotutte le soluzioniper questo su Internet.manessuno ha aiutato
lafirmageneratae inviata dal client api è 3ko8DUsUUEB4Hqaks68vGYnTjQM=
lafirmagenerata sul lato server è 5rPsul6zplhfNvb4o+Mz11O/OyI="
quindiil codice seguentenonfunziona
Immagino che la console API stiagenerando unafirma sbagliata. Perfavore aiutami a risolvere questoproblema.