<?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 Re: Admin API Token Question in APIs</title>
    <link>https://community.cisco.com/t5/apis/admin-api-token-question/m-p/4881478#M362</link>
    <description>&lt;DIV class="duo-migrated-content"&gt;&lt;P&gt;Hi there &lt;A class="mention" href="https://community.duo.com/u/rohit_pawar"&gt;@ROHIT_Pawar&lt;/A&gt; ! I noticed your question on one of our old Release Notes threads. I’ve moved the post over to the API forum so it doesn’t get missed &lt;IMG width="20" height="20" src="https://community.cisco.com/legacyfs/online/ciscoduo/cdn_emojis/twitter/slight_smile.png" style="display : inline;" /&gt; Cheers! -Tab&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 05 Aug 2022 18:07:32 GMT</pubDate>
    <dc:creator>TabBerger</dc:creator>
    <dc:date>2022-08-05T18:07:32Z</dc:date>
    <item>
      <title>Admin API Token Question</title>
      <link>https://community.cisco.com/t5/apis/admin-api-token-question/m-p/4881477#M361</link>
      <description>&lt;DIV class="duo-migrated-content"&gt;&lt;UL&gt;
&lt;LI&gt;[/admin/v1/users/[user_id]/tokens ] hello i have to check that the token is malicious or not .&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;so i am thinking to use this [/admin/v1/users/[user_id]/tokens ] and get token again and compare and validate it is right thing i am doing or anyother way exists /or what i am doing is needed or not (for malicious token it is checking internally )&lt;BR /&gt;
my code :-&lt;/P&gt;
&lt;PRE data-code-wrap="String"&gt;&lt;CODE class="lang-nohighlight"&gt;        String newState = request.getParameter("state");
        //if newState(coming from server) is not in the stateMap then that means session is expired ("message", "Session Expired")so return error.
        if (!stateMap.containsKey(newState)) {
            Debug.log("state is expired so go for DuoAuth again",Module);
            return "error";
        }
        String username = stateMap.remove(newState);
        //Exchange the auth duoCode for a Token object
        Token token = null;
        try {
            token = duoClient.exchangeAuthorizationCodeFor2FAResult(duoCode, username);
        } catch (DuoException e) {
            Debug.logError(e, Module);
            return "error";
        }
        Debug.logInfo ("generated token" + token, Module);
        // If the auth was successful, render the welcome page otherwise return an error
        if (DuoUtilHelper.authWasSuccessful(token)) {
            storedToken = token;
            return "success";
        } else {
            return "error";
        }```
i have a token received from exchangeAuthorizationCodeFor2FAResult(duoCode, username) i have to check that it is an valid token or it is malicious  token&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 04 Aug 2022 12:33:02 GMT</pubDate>
      <guid>https://community.cisco.com/t5/apis/admin-api-token-question/m-p/4881477#M361</guid>
      <dc:creator>ROHIT_Pawar</dc:creator>
      <dc:date>2022-08-04T12:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Admin API Token Question</title>
      <link>https://community.cisco.com/t5/apis/admin-api-token-question/m-p/4881478#M362</link>
      <description>&lt;DIV class="duo-migrated-content"&gt;&lt;P&gt;Hi there &lt;A class="mention" href="https://community.duo.com/u/rohit_pawar"&gt;@ROHIT_Pawar&lt;/A&gt; ! I noticed your question on one of our old Release Notes threads. I’ve moved the post over to the API forum so it doesn’t get missed &lt;IMG width="20" height="20" src="https://community.cisco.com/legacyfs/online/ciscoduo/cdn_emojis/twitter/slight_smile.png" style="display : inline;" /&gt; Cheers! -Tab&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 05 Aug 2022 18:07:32 GMT</pubDate>
      <guid>https://community.cisco.com/t5/apis/admin-api-token-question/m-p/4881478#M362</guid>
      <dc:creator>TabBerger</dc:creator>
      <dc:date>2022-08-05T18:07:32Z</dc:date>
    </item>
  </channel>
</rss>

