Welcome, Guest
Username: Password: Remember me
Archived CloudStack Forums for reference purposes please direct all future inquiries to the Apache CloudStack mailing lists.

incubator.apache.org/cloudstack/mailing-lists.html
  • Page:
  • 1
  • 2

TOPIC: sessionkey

sessionkey 1 year 3 months ago #10036

  • LucasT
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
hey guys

I'm broke my head to find the problem of my code.

I have a controller in the codeigniter:
public function request($sessionkey, $comand, $args, $httpRequest){
		if(!empty($comand)){
        $url = 'https://cloud.xx.com.br:12449/client/api?response=json&command='.$comand;
      }
      if(!empty($args)){
      	foreach($args as $k => $v){
      		$url .= '&'.$k.'='.urlencode($v);
      	}
     	}
        $httpRequest->setUrl($url);
        $httpRequest->send();
        $data = $httpRequest->getResponseData();
        $result = @json_decode($data['body']);
        echo '<pre>'.print_r($result, 1).'</pre>';
	}

Result:
stdClass Object
(
    [listaccountsresponse] => stdClass Object
        (
            [errorcode] => 401
            [errortext] => unable to verify user credentials and/or request signature
        )
)

I don't understand why return to me this error 401. I send the sessionkey, what more i have to send?

Thanks for any reply!

Hugs
Last Edit: 1 year 3 months ago by LucasT.
The administrator has disabled public write access.

Re: sessionkey 1 year 3 months ago #10037

  • LucasT
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
The documentation says about a cookie. Well, where is this cookie?
The administrator has disabled public write access.

Re: sessionkey 1 year 3 months ago #10118

  • jamesbjackson
  • jamesbjackson's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 43
  • Thank you received: 8
  • Karma: 2
When you get the HTTP Response back from the API when your logging in.. you see a session key called "JSESSIONID" you need to set this with each API HTTP Request to the API.. I hope this helps...
Last Edit: 1 year 3 months ago by jamesbjackson.
The administrator has disabled public write access.
The following user(s) said Thank You: LucasT

Re: sessionkey 1 year 3 months ago #10142

  • LucasT
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
Tks guys.

I wrote this before of send the $httpRequest:
$cookie = $httpRequest->getResponseCookies();
$cookie = $cookie[0]->cookies;
The administrator has disabled public write access.

Re: sessionkey 11 months 1 week ago #12209

  • chirauki
  • chirauki's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 193
  • Thank you received: 19
  • Karma: 11
Hi Lucas,

Could you plese post a sample url? I've been trying this and I am about to kill someone...

thx
The administrator has disabled public write access.

Re: sessionkey 11 months 1 week ago #12220

  • LucasT
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
Hi chirauki,

I ended up passing "username" and "password" (in MD5) because, in this case, access to "cloudstack" is within an iframe that is already logged in cloudstack by the API.

Does that help?

:)
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.351 seconds
About BuildaCloud.org Resources Site Info

Build a Cloud.org is a resource for those users who want to build cloud computing software with both open source and proprietary software.