Hi, Here there is the replay from the user: "Now I tried with "Authorization Code Grant": with this curl code stripped to minimum: $url = " https://account.lab.fiware.org/oauth2/authorize?response_type=code&client_id=2335&redirect_uri=http://tactmap.com/idm/login "; echo "url: <br>"; var_dump($url); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $url, CURLOPT_HTTPHEADER => array('Host: account.lab.fiware.org') )); $resp = curl_exec($curl); $info = curl_getinfo($curl); $response_info = $info['http_code']; curl_close($curl); echo "<br><br>CURL RESPONSE: <br>"; var_dump($resp); echo "<br><br>CURL Response http_code: <br>"; var_dump($response_info); echo "<br><br>CURL GET INFO: <br>"; var_dump($info); And I get this (301) for response: url: string(123) " https://account.lab.fiware.org/oauth2/authorize?response_type=code&client_id=2335&redirect_uri=http://tactmap.com/idm/login " CURL RESPONSE: string(0) "" CURL Response http_code: int(301) CURL GET INFO: array(26) { ["url"]=> string(123) " https://account.lab.fiware.org/oauth2/authorize?response_type=code&client_id=2335&redirect_uri=http://tactmap.com/idm/login" ["content_type"]=> string(24) "text/html; charset=utf-8" ["http_code"]=> int(301) ["header_size"]=> int(371) ["request_size"]=> int(153) ["filetime"]=> int(-1) ["ssl_verify_result"]=> int(0) ["redirect_count"]=> int(0) ["total_time"]=> float(0.216983) ["namelookup_time"]=> float(0.013897) ["connect_time"]=> float(0.061519) ["pretransfer_time"]=> float(0.166635) ["size_upload"]=> float(0) ["size_download"]=> float(0) ["speed_download"]=> float(0) ["speed_upload"]=> float(0) ["download_content_length"]=> float(0) ["upload_content_length"]=> float(0) ["starttransfer_time"]=> float(0.216944) ["redirect_time"]=> float(0) ["redirect_url"]=> string(124) " https://account.lab.fiware.org/oauth2/authorize/?response_type=code&client_id=2335&redirect_uri=http://tactmap.com/idm/login" ["primary_ip"]=> string(12) "130.206.84.7" ["certinfo"]=> array(0) { } ["primary_port"]=> int(443) ["local_ip"]=> string(13) "46.101.187.88" ["local_port"]=> int(56700) } Can you help me to build a correct request with php curl?" Thanks in advance. Kr, Xavier Carol. 2015-07-01 12:28 GMT+02:00 Xavier Carol Rossell <xavier.carol at i2cat.net>: > Hi, > > A user cannot access his account in the global instance of IdM KeyRock. > > "I am using fiware lab as our external site login platform. After last > update of fiware lab my interfaces to fiLab API (I used Rest) stopped > working because REST API was probably upgraded or something. Now when I am > trying to set up the API again I have stumbled upon issue where > authentication from my site tactmap.com to > https://account.lab.fiware.org/oauth/token with POST. > > https://github.com/ging/fi-ware-idm/wiki/Using-the-FIWARE-LAB-instance > > Can you some how guide me to right direction on what is wrong with my PHP > / cURL code." > > curl call is: > > $process = curl_init('https://account.lab.fiware.org/oauth2/token'); > //curl_setopt($process, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); > //curl_setopt($process, CURLOPT_HEADER, 1); > curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); > curl_setopt($process, CURLOPT_USERPWD, "petja.karki at versoteq.com" . ":" . "teppo1234"); > curl_setopt($process, CURLOPT_TIMEOUT, 30); > curl_setopt($process, CURLOPT_POST, 1); > curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE); > $return = curl_exec($process); > echo "CURL RESPONSE: <br>"; > var_dump($return); > $info = curl_getinfo($process); > echo "<br><br>CURL GET INFO: <br>"; > var_dump($info); > curl_close($process); > > and the response: > > CURL RESPONSE: > string(347) "HTTP/1.1 404 Not Found Date: Wed, 01 Jul 2015 10:06:00 GMT > Server: Apache/2.4.7 (Ubuntu) Vary: Accept-Language,Cookie X-Frame-Options: > SAMEORIGIN Content-Language: en Transfer-Encoding: chunked Content-Type: > application/json {"error": {"message": "No Consumer found with id: > petja.karki at versoteq.com", "code": 404, "title": "Not Found"}}" > > CURL GET INFO: > array(26) { ["url"]=> string(43) " > https://account.lab.fiware.org/oauth2/token" ["content_type"]=> > string(16) "application/json" ["http_code"]=> int(404) ["header_size"]=> > int(235) ["request_size"]=> int(236) ["filetime"]=> int(-1) > ["ssl_verify_result"]=> int(0) ["redirect_count"]=> int(0) ["total_time"]=> > float(0.246184) ["namelookup_time"]=> float(0.012655) ["connect_time"]=> > float(0.062011) ["pretransfer_time"]=> float(0.170537) ["size_upload"]=> > float(19) ["size_download"]=> float(112) ["speed_download"]=> float(454) > ["speed_upload"]=> float(77) ["download_content_length"]=> float(-1) > ["upload_content_length"]=> float(19) ["starttransfer_time"]=> > float(0.246143) ["redirect_time"]=> float(0) ["redirect_url"]=> string(0) > "" ["primary_ip"]=> string(12) "130.206.84.7" ["certinfo"]=> array(0) { } > ["primary_port"]=> int(443) ["local_ip"]=> string(13) "46.101.187.88" > ["local_port"]=> int(55742) } > Thanks you in advance. > Kr, Xavier Carol. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.fiware.org/private/fiware-creatifi-coaching/attachments/20150707/359f113f/attachment.html>
You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy Cookies policy