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:
value: { type: TYPE_BASIC; } } security: { // Made up security so we can apply "Bearer <JWT_TOKEN>" key: "BearerJwt"; value: {}; } } // Default security definition. security: { security_requirement: { key: "BearerJwt"; value: {}; } }, }; /** * The developer console RPC protocol service built with GRPC.
You can retrieve a Bearer Token by Authenticating with the server first:
}, }; /** * The developer console RPC protocol service built with GRPC. */ service Console { // Authenticate a console user with username and password. rpc Authenticate (AuthenticateRequest) returns (ConsoleSession) { option (google.api.http) = { post: "/v2/console/authenticate", body: "*" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { security: { security_requirement: {}; }; }; } // Add a new console user.
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