P_AUTH is ignored when using JSONWS API
Written By
Gustavo Vasconcelos
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
Legacy Article
You are viewing an article from our legacy "FastTrack"
publication program, made available for informational purposes. Articles
in this program were published without a requirement for independent
editing or verification and are provided"as is" without
guarantee.
Before using any information from this article, independently verify its
suitability for your situation and project.
Issue
- When using
JSONWS API with the P_AUTH parameter instead of credentials (email/password), the response is HTTP code 403: Forbidden.
Environment
- Liferay DXP (any version)
Resolution
- According to our documentation, "This authentication token is associated with your browser session and is called
p_auth".
- This means that the browser session, referred as
JSESSIONID and presented as a cookie, must also be send within the request.
- An example using CURL which causes the error is below:
curl "http://localhost:8080/api/jsonws/user/get-user-by-id?userId=20125&p_auth=1OYw1jJ7"
- Another CURL example below shows the correct request, passing both the parameter
p_auth and the cookie JSESSIONID attached to it.
curl "http://localhost:8080/api/jsonws/user/get-user-by-id?userId=20125&p_auth=1OYw1jJ7" \
-H 'Cookie: JSESSIONID=4C98B71E8C2A934971196907DF4EDA2C'
Did this article resolve your issue ?