<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to get Authorization and Date headers in APIs</title>
    <link>https://community.cisco.com/t5/apis/how-to-get-authorization-and-date-headers/m-p/4876186#M36</link>
    <description>&lt;DIV class="duo-migrated-content"&gt;&lt;P&gt;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 ?&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 05 Feb 2020 06:08:52 GMT</pubDate>
    <dc:creator>Ankush_Patel</dc:creator>
    <dc:date>2020-02-05T06:08:52Z</dc:date>
    <item>
      <title>How to get Authorization and Date headers</title>
      <link>https://community.cisco.com/t5/apis/how-to-get-authorization-and-date-headers/m-p/4876186#M36</link>
      <description>&lt;DIV class="duo-migrated-content"&gt;&lt;P&gt;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 ?&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 05 Feb 2020 06:08:52 GMT</pubDate>
      <guid>https://community.cisco.com/t5/apis/how-to-get-authorization-and-date-headers/m-p/4876186#M36</guid>
      <dc:creator>Ankush_Patel</dc:creator>
      <dc:date>2020-02-05T06:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Authorization and Date headers</title>
      <link>https://community.cisco.com/t5/apis/how-to-get-authorization-and-date-headers/m-p/4876187#M37</link>
      <description>&lt;DIV class="duo-migrated-content"&gt;&lt;P&gt;Take a look at the &lt;A href="https://github.com/duosecurity/duo_client_java"&gt;Java API client samples on GitHub&lt;/A&gt;.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 05 Feb 2020 16:54:50 GMT</pubDate>
      <guid>https://community.cisco.com/t5/apis/how-to-get-authorization-and-date-headers/m-p/4876187#M37</guid>
      <dc:creator>DuoKristina</dc:creator>
      <dc:date>2020-02-05T16:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Authorization and Date headers</title>
      <link>https://community.cisco.com/t5/apis/how-to-get-authorization-and-date-headers/m-p/4876188#M38</link>
      <description>&lt;DIV class="duo-migrated-content"&gt;&lt;P&gt;I was unable to reproduce the authorization and data using the python code&lt;/P&gt;
&lt;P&gt;import base64, email, hmac, hashlib, urllib&lt;BR /&gt;
def sign(method, host, path, params, skey, ikey):&lt;BR /&gt;
“”"&lt;BR /&gt;
Return HTTP Basic Authentication (“Authorization” and “Date”) headers.&lt;BR /&gt;
method, host, path: strings from request&lt;BR /&gt;
params: dict of request parameters&lt;BR /&gt;
skey: secret key&lt;BR /&gt;
ikey: integration key&lt;BR /&gt;
“”"&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;# 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('&amp;amp;'.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)}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please can you help&lt;/P&gt;
&lt;P&gt;Thanks,&lt;BR /&gt;
Regards ,&lt;BR /&gt;
Ankush&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 06 Feb 2020 07:01:41 GMT</pubDate>
      <guid>https://community.cisco.com/t5/apis/how-to-get-authorization-and-date-headers/m-p/4876188#M38</guid>
      <dc:creator>Ankush_Patel</dc:creator>
      <dc:date>2020-02-06T07:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Authorization and Date headers</title>
      <link>https://community.cisco.com/t5/apis/how-to-get-authorization-and-date-headers/m-p/4876189#M39</link>
      <description>&lt;DIV class="duo-migrated-content"&gt;&lt;P&gt;Is there any solution for this just for a reminder.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 10 Feb 2020 08:10:35 GMT</pubDate>
      <guid>https://community.cisco.com/t5/apis/how-to-get-authorization-and-date-headers/m-p/4876189#M39</guid>
      <dc:creator>Ankush_Patel</dc:creator>
      <dc:date>2020-02-10T08:10:35Z</dc:date>
    </item>
  </channel>
</rss>

