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

Authorization token usage clarification

$
0
0

I am working on native android using your github version as a base.
I am trying to access a team's channels but I am getting authorization errors. Token is obtained from the cookie I get from /login. I am temporarily just using teemb as my team, I will make it dynamic later after this works for sure, I have tried:


Attempt 1

@GET("/api/v3/teams/teemb/channels/")
Promise<User> getChannels(@Header("Authorization: Bearer TOKEN") String token);

with error:

{"status_code":401,
"message":"Invalid or expired session, please login again.",
"id":"api.context.session_expired.app_error",
"is_oauth":false,
"detailed_error":"token=TOKEN: xw1hjgourbn3d8mromd75i5qbe",
"request_id":"kdgqmtp4itrsjdje13pr8jwiqr"}


Attempt 2
@GET("/api/v3/teams/teemb/channels/")
Promise<User> getChannels(@Header("Authorization: Bearer") String token);

with error:

{"status_code":401,
"message":"Invalid or expired session, please login again.",
"id":"api.context.session_expired.app_error",
"is_oauth":false,
"detailed_error":"token= uhb5a8tt33rejp6qtrwtdhf8hy",
"request_id":"5eerg4nttigybcmirx6u3q756o"}


Attempt 3
@GET("/api/v3/teams/teemb/channels/")
Promise<User> getChannels(@Header("Authorization Bearer Token") String token);

with error:

{"status_code":500,
"message":"Invalid or expired session, please login again.",
"id":"api.context.session_expired.app_error",
"is_oauth":false,
"detailed_error":"token=xe8oza8z57gsxeh4b9rw3qhdoo Appears to bea CSRF attempt",
"request_id":"pry8whe13py8zbhcgs6nr88qph"}


Attempt 4
@GET("/api/v3/users/me")
Promise<User> getMe();

with error:

{"status_code":500,
"message":"Invalid or expired session, please login again.",
"id":"api.context.session_expired.app_error",
"is_oauth":false,
"detailed_error":"token=51nf7r71rfrxzfeog8go5jj16h Appears to bea CSRF attempt",
"request_id":"heos31w83pn5mpxqrhna6qawbo"}


Other notes
Getting the user works and returns the user I logged in as.
@GET("/api/v3/users/me")
Promise<User> getMe();

How exactly am I supposed to do this?


Viewing all articles
Browse latest Browse all 25778

Trending Articles



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