java - Unexpected url in case of signature base string of woocommerce api through okhttp client -


the url generate signature

get&http%3a%2f%2fprojectrepo.net%2fscoop%2fwp-json%2fwc%2fv2%2forders&oauth_consumer_key%3dck_2f53925cb6d2c8f96407f09f67f5f118d01ed80e%26oauth_signature_method%3dhmac-sha1 

the string without utf encoding is

get&http://----.net/----/wp-json/wc/v2/orders&oauth_consumer_key=----&oauth_signature_method=----

the problem when url passed through okhttp client generate signature,the "unexpected url" error shown on log.

request request = new request.builder()                     .url(signaturebasestring)                     .build(); response response = null; response = client.newcall(request).execute(); 

what wrong? can't okhttp client used generate signature url utf encoded required generate signature?

got solution.

the code generating signature in android given follows

mac mac = null; mac = mac.getinstance("hmac-sha1"); string secret = oauthconsumersecretkeystringvalue+"&";         mac.init(new secretkeyspec(secret.getbytes("utf-8"), "hmac-sha1")); signature = base64.encodetostring(mac.dofinal(signaturebasestring.getbytes("utf-8")), 0).trim(); 

the oauthconsumersecretkeystringvalue variable has consumer secret key.

the signature base string string having oauth parameters beside oauth_signature.this string used generate signature.

now "get&" characters mandatory @ time of signature generation.but when data posted should post @ url devoid of "get&" characters.

everyone time.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -