Re: Where's the token from login endpoint? #api


groups@...
 

On Tue, Sep 7, 2021 at 04:37 AM, Derek Milliner wrote:
Meant to add to that that the example in the API docs (https://groups.io/api#login) is a bit misleading on that - it shows a cookie-based request with a token-based response :-)

Derek,

Thank you so much. That explains my confusion -- if the documentation is mixed up, that provides a shaky foundation to build on.

So I followed your example adding the "token=yes" POST parameters and was able to get a token back. The next thing I would like to do is to get a group's topics using token-based auth. The example in the documentation is:

curl "https://groups.io/api/v1/gettopics?groupid=2" \
-b "cookies.curl"


The documentation example above looks like a cookies-based auth request. How do I convert that into a token-based request?

For example, this below results in an "unauthorized" error:

dave@Moonquake:~ $ curl "https://groups.io/api/v1/gettopics?group_name=<group_name>" -d token="<redacted>"
{"object":"error","type":"unauthorized_error","extra":""}

 

*pulls out hair*

Likewise I tried this:

dave@Moonquake:~ $ curl "https://groups.io/api/v1/gettopics?group_name=<group_name>" -a 123456: -d token="<redacted>"
{"object":"error","type":"unauthorized_error","extra":""}


What is weird is I can get the cookie-based auth working in Postman (but not token-based auth) -- not sure where the differences is between Postman and curl, honestly.

I appreciate all your assistance with me figuring out how to use the API.

-Dave

Join api@beta.groups.io to automatically receive all group messages.