Quantcast
Channel: Mattermost Discussion Forums - Latest posts
Viewing all articles
Browse latest Browse all 25778

Clarification on ApiUserRequired in platform's api.go

$
0
0

I am working off the native android app in your github to connect to mattermost api here, specifically this one

BaseRoutes.Teams.Handle("/all_team_listings",ApiUserRequired(GetAllTeamListings)).Methods("GET")

and I am confused at where it says ApiUserRequired. Since it is a GET request, it cannot have a body so I am assuming that I have to put a User into the header? The line I am using in android is

@GET("/api/v3/teams/all_team_listings")
Promise<Object> getAllTeamListings(@Header("user") User user);

getAllTeamListings creates a user with email, password, etc and passes it in.

As a side note, I am able to use /api/v3/teams/all without a problem. I think it has to do with ApiUserRequired as that seems to be the only difference in between them. I have tried not having a header and having it return Promise<User> but they don't work. The problem is that it returns a 401 error and the detailed error report just lists the token id. When messing around with params and stuff, I also occasionally get Appears to be a CSRF attempt if anyone has any explanation for that, that would be nice.

What am I doing wrong? Should I be using Promise<Object> at all? Any tips/pointers would be great.


Viewing all articles
Browse latest Browse all 25778

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>