09-10-2021 03:30 AM
Hi,
I've been using the SD-Wan API and it worked with no problems.
But, when I'm trying to do the logout I'm not able to get the code 302. I think it has to do with the random-number that appears in the code snippet.
anyone knows what am I suppose to insert in random-number field ?
Thank you,
Gonçalo Freitas
09-11-2021 05:53 AM
@GoncaloFreitas61868 typically I sent a GET request
https://{{vmanage}}:{{port}}/logout?nocache
09-11-2021 12:57 PM
09-12-2021 01:00 AM
@GoncaloFreitas61868 the XSRF token should be in the http header.
Hope this helps.
09-13-2021 01:47 AM
12-15-2022 08:25 PM
It will be google translation.
Please use the cookie used to acquire the token.
If there are no Session updates, you're probably fine.
It's a powershell sample, and I think it's hard to read.
$get_Cookie_params = @{
body = "j_username=admin&j_password=$password"
uri = "https://$vmanaggIpAddress/j_security_check"
headers = @{"Content-Type" = "application/x-www-form-urlencoded"}
method = "Post"
}
$get_Cookie_result = Invoke-WebRequest @get_Cookie_params -SessionVariable mySession
$get_token_params = @{
uri = "https://$vmanaggIpAddress/dataservice/client/token"
method = "Get"
}
$get_token_result = Invoke-WebRequest @get_token_params -WebSession $mySession
##Session storage for logout
$log_out_onlye_Session = $mySession
~Processing using token~
$delet_token_params = @{
uri = "https://$vmanaggIpAddress/logout?nocache"
method = "get"
headers = @{"Content-Type" = "application/x-www-form-urlencoded"; "X-XSRF-TOKEN" = $get_token_result.Content}
}
$out_put=Invoke-WebRequest @delet_token_params -WebSession $log_out_onlye_Session
##https://www.postman.com/ciscodevnet/workspace/cisco-devnet-s-public-workspace/request/3224967-d388ca2d-523e-49e1-b143-fcfad0b2cc2c
##Headers refer to the above.
You have not correctly pushed the updated cookie to the service that issued the token. I think it's
To say the least.
200/OK came out.
Unfortunately, it is unclear if the token is actually returned, as it differs from the original document.
> $out_put
StatusCode : 200
StatusDescription : OK
Content : <html>
<head>
<meta charset="utf-8">
<title>Cisco SD-WAN</title>
<link rel="stylesheet" type="text/css" href="/styles/login.css">
<link rel="stylesheet" type="text/css" href="/fonts/fo...
RawContent : HTTP/1.1 200 OK
x-xss-protection: 1; mode=block
pragma: no-cache,no-cache
x-frame-options: DENY
content-security-policy: default-src 'self' *.walkme.com;script-src 'self' https://cdn.walkme.com ht...
Forms : {loginForm}
Headers : {[x-xss-protection, 1; mode=block], [pragma, no-cache,no-cache], [x-frame-options, DENY], [content-security-policy, default-src 'self' *.walkme.com;script-src 'self' https://cdn.walkme.com https://maps.googleapis.com 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src '
self' data: * ; font-src 'self' https://fonts.googleapis.com https://fonts.gstatic.com/ data:; form-action 'self' https://*.pingidentity.com https://*.pingone.com; frame-src 'self' https://cdn.walkme.com; connect-src 'self' https://*.walkme.com; object-src 'none']...}
Images : {@{innerHTML=; innerText=; outerHTML=<IMG class=center alt="Cisco SD-WAN" src="/images/sdwan_logo.svg">; outerText=; tagName=IMG; class=center; alt=Cisco SD-WAN; src=/images/sdwan_logo.svg}, @{innerHTML=; innerText=; outerHTML=<IMG alt="Login Error" src="/images/error.svg">; outerText=; tag
Name=IMG; alt=Login Error; src=/images/error.svg}, @{innerHTML=; innerText=; outerHTML=<IMG class=spinner alt=Loader src="/images/loader.png">; outerText=; tagName=IMG; class=spinner; alt=Loader; src=/images/loader.png}}
InputFields : {@{innerHTML=; innerText=; outerHTML=<INPUT id=j_username class=login-input-value maxLength=64 name=j_username autocomplete="off" autofocus oninput="setView('1')" placeholder="Username">; outerText=; tagName=INPUT; id=j_username; class=login-input-value; maxLength=64; name=j_username; autoc
omplete=off; autofocus=; oninput=setView('1'); placeholder=Username}, @{innerHTML=; innerText=; outerHTML=<INPUT onkeyup=validateTacForm() id=j_challenge class=login-input-value size=34 name=j_challenge autocomplete="off" placeholder="Challenge Key">; outerText=; tagName=INPUT; onkeyup=vali
dateTacForm(); id=j_challenge; class=login-input-value; size=34; name=j_challenge; autocomplete=off; placeholder=Challenge Key}, @{innerHTML=; innerText=; outerHTML=<INPUT onchange=copyToClipboard() id=copy_challenge type=checkbox value="">; outerText=; tagName=INPUT; onchange=copyToClipboa
rd(); id=copy_challenge; type=checkbox; value=}, @{innerHTML=; innerText=; outerHTML=<INPUT onchange="getChallenge('rekey')" id=refresh_challenge type=checkbox value="">; outerText=; tagName=INPUT; onchange=getChallenge('rekey'); id=refresh_challenge; type=checkbox; value=}...}
Links : {}
ParsedHtml : System.__ComObject
RawContentLength : 7013
09-23-2024 07:57 AM
Hi Gonzalo
Maybe too late, but here my test.
I used "null" or empty as random number, I'm not geting the 302 code, or I'm not able to see that, I see a 200 code status and the login page, I tested with firefox and python with "session" module from "request" library.
But I checked in the user_sessions web page: https://vmanage-1.sdwan.cisco.com/#/app/administration/manage_users/user_sessions , and the session was released.
Regards,
JI
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