XF 2.1 Problem with APIs

Miacommunity

Well-known member
I'm trying to call XenForo rest api v2 on my app, and I am going to get all conversations by calling "conversations" GET methods.
But it tells me I need to login when I call it although I have logged in with auth api.

I called this api:
xenforo.com

XF 2.1 API endpoints
This is a temporary location for the XF 2.1 API end point documentation. It will likely move to the core developer documentation at some point in the future. This document assumes you have already created an API key and setup the necessary headers for your request. Learn more about using the API.
xenforo.com
xenforo.com

and the result is:
{
code = "login_required";
message = "You must be logged-in to do that.";
params = (
);
}

How can we resolve this problem?
 
@Brogan @Chris D
Why move my request for assistance always here where I will not find anyone able to solve this problem?
This is a problem I have with a function developed by XenForo.
Am I a customer so unworthy of help?
 
It's not a bug.

It pertains to custom development, hence why the thread was moved to the correct forum.
 
We cannot provide support with customisation and development discussions. We ascertained that this wasn't a bug.

Put simply, you're using the API wrong. The purpose of the auth endpoint is to simply verify whether you have the correct username and password for a given user and it does not then allow you unfettered access to use the rest of the API as that user.

Every single API interaction, as is a common pattern with REST APIs, requires you to log in as the desired user with a specific API key for that user, or with a super user key and a specific user's user ID.

Further support with the API would need to be provided by this forum, or you would need to hire a developer to work with the API on your behalf.
 
Can you explain the params of this api, then?
I have got same error when I use "converstations" get method to retreive conversation list.
I have set XF-Api-Key to the http request header already, but received this error:
{
code = "login_required";
message = "You must be logged-in to do that.";
params = (
);
}
This error doesn't explain about params.
Can you help me?
 
We cannot provide support with customisation and development discussions. We ascertained that this wasn't a bug.

Put simply, you're using the API wrong. The purpose of the auth endpoint is to simply verify whether you have the correct username and password for a given user and it does not then allow you unfettered access to use the rest of the API as that user.

Every single API interaction, as is a common pattern with REST APIs, requires you to log in as the desired user with a specific API key for that user, or with a super user key and a specific user's user ID.

Further support with the API would need to be provided by this forum, or you would need to hire a developer to work with the API on your behalf.

What an ignorant reply. This request is not about a question on how to use REST APIs in general.
Rather, it's about how to use your documented REST APIs, as in what the param/header key must be called to identify yourself and solve the "You must be logged-in to do that" error.

Either way, the answer for others is below:
"
If the API key selected is a super user key, you may pass the user ID of the context user via the XF-Api-User header. If no user ID is passed, the context will default to a guest.
"
 
Top Bottom