02-04-2020 10:08 PM
As we tried to auth api as per documentation we cant able to generate authorization and date headers. Any valid JAVA code is there to generate that ?
02-05-2020 08:54 AM
Take a look at the Java API client samples on GitHub.
02-05-2020 11:01 PM
I was unable to reproduce the authorization and data using the python code
import base64, email, hmac, hashlib, urllib
def sign(method, host, path, params, skey, ikey):
“”"
Return HTTP Basic Authentication (“Authorization” and “Date”) headers.
method, host, path: strings from request
params: dict of request parameters
skey: secret key
ikey: integration key
“”"
# create canonical string
now = email.Utils.formatdate()
canon = [now, method.upper(), host.lower(), path]
args = []
for key in sorted(params.keys()):
val = params[key]
if isinstance(val, unicode):
val = val.encode("utf-8")
args.append(
'%s=%s' % (urllib.quote(key, '~'), urllib.quote(val, '~')))
canon.append('&'.join(args))
canon = '\n'.join(canon)
# sign canonical string
sig = hmac.new(skey, canon, hashlib.sha1)
auth = '%s:%s' % (ikey, sig.hexdigest())
# return headers
return {'Date': now, 'Authorization': 'Basic %s' % base64.b64encode(auth)}
Please can you help
Thanks,
Regards ,
Ankush
02-10-2020 12:10 AM
Is there any solution for this just for a reminder.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide