× Requests and support related to jBackend.

endpoint/get/user/profile

  • darrelluk
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 6 months ago #6684 by darrelluk
endpoint/get/user/profile was created by darrelluk
Hi,

Hope you can help me figure why this has stopped working. I am now on Joomla 3.8.8

Using Postman GET

1. www.SITENAMEWASHERE.co.uk/index.php/endpoint/post/user/login?username=THEUSERNAME&password=THEPASSWORD

2. I get an ok response.

3. www.SITENAMEWASHERE.co.uk/index.php/endpoint/get/user/profile

4. I get a ko response, user not logged in! I guess step 3 isn't aware I just did step 1.

I have it set to use session_id. I hope you can advise how I troubleshoot this. Do I need to include the session_id in step 3?

Thx, Darrell

Please Log in or Create an account to join the conversation.

  • darrelluk
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 6 months ago #6685 by darrelluk
Replied by darrelluk on topic endpoint/get/user/profile
Hi,

Once I have logged in and then try to get the user profile, I now always get user not logged in error. I am testing in Postman and Joomla 3.8.8

1. www.SITEURL.co.uk/index.php/endpoint/post/user/login?username=USERNAME&password=PASSWORD
2. I get an ok response and a session_id
3. www.SITEURL.co.uk/index.php/endpoint/get/user/profile
4. I get a ko response user not logged in.

Step 3 doesn't know I just did Step 1.

I hope you can advise how I can troubleshoot the issue.

Thx, Darrell

Please Log in or Create an account to join the conversation.

More
6 years 5 months ago #6692 by admin
Replied by admin on topic endpoint/get/user/profile
Hi Darrel,
the standard way to manage the session for Joomla is through cookies, so please check if you are sending back always the same session cookie in your requests, otherwise Joomla will not be able to identify you (i.e. a new session will be created for each request). You can check this inspecting headers under PostMAN.

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

  • darrelluk
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 5 months ago - 6 years 5 months ago #6702 by darrelluk
Replied by darrelluk on topic endpoint/get/user/profile
Hi Luigi,

If I wanted to use session_id instead how would I do that? Do I need to include the session_id somehow in the www.SITEURL.co.uk/index.php/endpoint/get/user/profile request?

I just checked the cookies in the request headers.

Step 1 has two cookies and a third one that states logged in under joomla_user_state. When I then do step 3 the two cookies are still there with the same values but the joomla_user_state has gone. My steps 3 fails with "error_code": "USR_UNL". It didn't used to do this!

Also, if I tried doing multiple logins before doing a logout I used to get the already logged in error. Now, I can just keep logging in over and over without any error. It always returns a new session_id (and cookies).

I hope you can help.

Thx, Darrell
Last edit: 6 years 5 months ago by darrelluk. Reason: correction

Please Log in or Create an account to join the conversation.

  • darrelluk
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 5 months ago #6703 by darrelluk
Replied by darrelluk on topic endpoint/get/user/profile
Hi,

This is what I am doing in Postman. Can you advise on what I am doing wrong?

1. www.WEBSITE.co.uk/index.php/endpoint/post/user/login?username=USERNAME&password=PASSWORD

{
"status": "ok",
"userid": "1993",
"username": "USERNAME",
"session_id": "9vcvj0t8gcgj3p9v4nvbkm6v76"
}

2. www.WEBSITE.co.uk/index.php/endpoint/get/user/profile?session_id=9vcvj0t8gcgj3p9v4nvbkm6v76

{
"status": "ko",
"error_code": "USR_UNL",
"error_description": "User not logged in"
}

I always get USE_UNL no matter if I use cookies or try to use session_id when getting the profile.

If I do step 1 over and over, I don't get the "already logged in" error, I just get another different cookie or session_id.

I hope you can help.

Thx, Darrell

Please Log in or Create an account to join the conversation.

More
6 years 5 months ago #6704 by admin
Replied by admin on topic endpoint/get/user/profile
Hi Darrel,
if you want to use the session id you need to enable it in the user plugin (it works only for the payed version of jBackend, it is not supported in the Community version).

After enabled it, you can just pass the "session_id" variable as query parameter, or in the body (works also with JSON payload).

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

Time to create page: 0.135 seconds