Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

login api issue

Open neha1deshmukh opened this issue 9 years ago • 4 comments

Rocket.Chat Version: 0.50.1

Hi, When i am hitting https://www.example.com/api/v1/login -d username=xxxx&password=xxx getting error "There is no route for the path" and not able to login rocket chat. OR When try to use curl.... getting no response . //login function function talklogin($fuser, $pass) { $service_url = 'https://xxx-xxxx-xxx/api/v1/login'; $curl = curl_init($service_url); $curl_post_data = array( "password" => $pass, "username" => $fuser, ); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($curl_post_data)); $curl_response = curl_exec($curl); curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); print_r(json_decode($curl_response)); }

What am I doing wrong? Thanks in advance for any insight.

neha1deshmukh avatar Jan 31 '17 10:01 neha1deshmukh

Make sure you're actually using the POST method and then change username to user.

graywolf336 avatar Jan 31 '17 12:01 graywolf336

Its working now. Thank you very much for your quick response :)

neha1deshmukh avatar Feb 01 '17 06:02 neha1deshmukh

@neha1deshmukh could you please close the issue yourself if this is solved? :+1:

TheReal1604 avatar Feb 01 '17 06:02 TheReal1604

cant able to login using curl , I have written above script in external site and then after running this script, when I checked Rocket chat its still showing login form. script successfully returns token.

mborhade avatar Aug 01 '17 09:08 mborhade