Reply

logout API not working

Expert
Posts: 188
2902     0

Hi,

 

Just doing some testing here, I am by no means and expert when it comes to REST API programming.

 

I've managed to successfully authenticate and then use the cookie for subsequent calls, but when I call the /logout method I get an HTTP error 500 and the cookie is still valid. Here's the output from my test script that just gets the grid object:

 

C:\Users\robertsp\Documents>perl scripts\infoblox\ib_login_test.pl 192.168.0.33 paul
Password: *********

Session timeout = 3600
HTTP response = 200
$VAR1 = '{"_ref": "grid/b25lLmNsdXN0ZXIkMA:Infoblox"}';
Call logout API
HTTP response = 500
Get grid object after logout
HTTP response = 200
$VAR1 = '{"_ref": "grid/b25lLmNsdXN0ZXIkMA:Infoblox"}';

 

The bit in red is where it's going wrong.

 

This is my logout API call:

 

my $headers = {
  Accept => 'application/json'
};

 

$client->POST('/logout',$headers);

 

If I log out ok then the final call should fail, but it still works because the cookie didn't get cleared. Am I doing something wrong?

Paul Roberts
PCN (UK) Ltd

All opinions expressed are my own and not representative of PCN Inc./PCN (UK) Ltd. E&OE

Re: logout API not working

Expert
Posts: 188
2902     0

Ok I think I figured this out. I was passing headers in my API call, if I don't explictly pass any then it works.

 

e.g. I changed this:

 

$client->POST('/logout',$headers);

 

to this:

 

$client->POST('/logout');

 

I am so used to passing headers I didn't think to *not* pass them. Doh!

Paul Roberts
PCN (UK) Ltd

All opinions expressed are my own and not representative of PCN Inc./PCN (UK) Ltd. E&OE

Re: logout API not working

New Member
Posts: 2
2902     0

C:\Users\robertsp\Documents>perl scripts\infoblox\ib_login_test.pl 192.168.0.33 paul Password: ********* Session timeout = 3600 HTTP response = 200 $VAR1 = '{"_ref": "grid/b25lLmNsdXN0ZXIkMA:Infoblox"}'; Call logout API HTTP response = 500 Get grid object after logout HTTP response = 200 $VAR1 = '{"_ref": "grid/b25lLmNsdXN0ZXIkMA:Infoblox"}';

 

https://vivatv.me/

Re: logout API not working

New Member
Posts: 1
2902     0
this is a easy problem this is not that difficult just follow these steps and it will be easy for you just like me Descarga RepelisPlus download GTA 5 for Android 
 
 

Re: logout API not working

New Member
Posts: 1
2902     0

i'm also facing issue in API  

jiofi loginforpc

Re: logout API not working

New Member
Posts: 1
2902     0

the luckiest years for you. Also, Get your prize and check your chance to win the lottery. Also, As you recognize, measure several prizes and the draw has survived every day. Stay tuned to view and upload the 2020 Sambad Lottery results here.

Re: logout API not working

New Member
Posts: 2
2903     0
4
1

I integrate google login api and It works fine but there is an error in logout. The sign-out process is not working. The logged user will not sign out after clicking the sign-out link function. This is my code:

<meta name="google-signin-client_id" content="here my api .apps.googleusercontent.com">
<script src="https://apis.google.com/js/platform.js" async defer></script>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<a href="javascript&colon;signOut()">Sign Out</a>
<script>function onSignIn(googleUser) {
    var profile = googleUser.getBasicProfile();
     if(profile.getEmail()!="") {
      var myKeyVals = { token : googleUser.getAuthResponse().id_token }
      $.ajax({
        type: "POST",
        url: "validate.php",
        data: myKeyVals,
        dataType: "text",
        success : function(data) {
            window.location = "page";
        }
      });
    }
  }

  function signOut() {
    var auth2 = gapi.auth2.getAuthInstance();
    auth2.signOut().then(function () {
    });
  }</script>

BeeTV APK

Re: logout API not working

New Member
Posts: 1
2903     0
To fix the API call for those two situations, make sure that the credentials you are using have the access-level required by the endpoint, or that the access token has the correct permissions. A less common reason we might see this error is if we're not explicit about the Accept header value.
 
Showing results for 
Search instead for 
Did you mean: 

Recommended for You