keenlabs / keen-gem

Official Ruby client for the Keen IO API. Build analytics features directly into your Ruby apps.

Home Page:https://keen.io/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generated Scoped Key fails with Invalid API Key error

subbuthepeaceful opened this issue · comments

Using the gem to generate a scoped key and subsequently using that key in a query throws an Invalid API Key Error.

The newly generated scoped key can be successfully encrypted/decrypted, but cannot be used.

To verify, please initialize a new Keen Client with a generated scoped key corresponding to a filter, say

data = { "filters" => [{ "property_name" => "", "operator" => "eq", "property_value" => "" }] }
scoped_key_generator = Keen::ScopedKey.new master_key, data
scoped_read_key = scoped_key_generator.encrypt!

client = Keen::Client.new( project_id: <PROJECT_ID>, read_key: scoped_read_key )

Now, perform a count query on some collection in the project
client.count(...)