ppissanetzky
New member
I'm working on a Node application that is on the same domain as our forum. I'd like to authenticate every request to this application against the forum, to ensure the calling user is valid and get user information. My application has access to all the XF cookies in every request.
What I'm doing now is grabbing the xf_session cookie from the incoming request and then calling the auth/from-session endpoint with a super user key (and no user id header) to authenticate the user and get the information. This is not very reliable. I do not include any other cookies from the incoming request in this API request.
Some incoming requests are missing the xf_session cookie - presumably because it has expired but include the xf_user cookie. I see that visiting the forum in that case, a new session is created.
So, my question is, how should I go about doing this? How can I authenticate every request and get the calling user's info?
What I'm doing now is grabbing the xf_session cookie from the incoming request and then calling the auth/from-session endpoint with a super user key (and no user id header) to authenticate the user and get the information. This is not very reliable. I do not include any other cookies from the incoming request in this API request.
Some incoming requests are missing the xf_session cookie - presumably because it has expired but include the xf_user cookie. I see that visiting the forum in that case, a new session is created.
So, my question is, how should I go about doing this? How can I authenticate every request and get the calling user's info?