Accessing Console API v2 In Nakama 3

Hi,

We previously use nakama console API for administrative and QA purpose, so we piggyback on storage listing in order to get collections of all data that is stored by admin account

We access endpoint with this, but on Nakama 3.0, we got this error

curl -u root:password http://url:port/v2/console/storage\?user_id\=00000000-0000-0000-0000-000000000000
curl: (52) Empty reply from server

we then tried downgrading it again to v2 2.15, accessing with the same method

curl -u root:password http://url:port/v2/console/storage\?user_id\=00000000-0000-0000-0000-000000000000
{"objects":[{"collection":"config_ios","key":"onlineConfig","user_id":"00000000-0000-0000-0000-000000000000","value":"{\"testValue"} omitted...

And it returns the expected collections, is there anything we need to update in order to accommodate this?

Thanks

In Nakama 3, you’ll need to authenticate with the Console API using Bearer Tokens:

You can retrieve a Bearer Token by Authenticating with the server first:

curl -X POST http://localhost:7351/v2/console/authenticate -d '{"username":"admin","password":"password"}'

Once you have a Bearer Token, you can then execute the call with the token like this:

curl -X GET "http://127.0.0.1:7351/v2/console/storage/{collection}/{key}/{user_id}" \
  -H 'Authorization: Bearer <session token>'

Note that some of the URLs have changed to allow for the extra features added to the console.

3 Likes