{"action":"created","issue":{"url":"https://api.github.com/repos/lonelycode/tyk/issues/130","labels_url":"https://api.github.com/repos/lonelycode/tyk/issues/130/labels{/name}","comments_url":"https://api.github.com/repos/lonelycode/tyk/issues/130/comments","events_url":"https://api.github.com/repos/lonelycode/tyk/issues/130/events","html_url":"https://github.com/lonelycode/tyk/issues/130","id":115231770,"number":130,"title":"Tyk Dashboard not finding keys created from Gateway API","user":{"login":"jesucarr","id":28097,"avatar_url":"https://avatars.githubusercontent.com/u/28097?v=3","gravatar_id":"","url":"https://api.github.com/users/jesucarr","html_url":"https://github.com/jesucarr","followers_url":"https://api.github.com/users/jesucarr/followers","following_url":"https://api.github.com/users/jesucarr/following{/other_user}","gists_url":"https://api.github.com/users/jesucarr/gists{/gist_id}","starred_url":"https://api.github.com/users/jesucarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jesucarr/subscriptions","organizations_url":"https://api.github.com/users/jesucarr/orgs","repos_url":"https://api.github.com/users/jesucarr/repos","events_url":"https://api.github.com/users/jesucarr/events{/privacy}","received_events_url":"https://api.github.com/users/jesucarr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-05T08:24:47Z","updated_at":"2015-11-05T08:55:45Z","closed_at":null,"body":"I'm creating my own keys from my app using the Gateway API. This is the post request to /tyk/keys/{key}\r\n\r\n    {\r\n      \"last_check\":0,\r\n      \"allowance\":1000,\r\n      \"rate\":1000,\r\n      \"per\":60,\r\n      \"expires\":0,\r\n      \"quota_max\":-1,\r\n      \"quota_renews\":1446684367,\r\n      \"quota_remaining\":-1,\r\n      \"quota_renewal_rate\":60,\r\n      \"access_rights\":{\r\n        \"c516a9b1c3e6498979e731d06cb8dc26\":{\r\n          \"api_id\":\"c516a9b1c3e6498979e731d06cb8dc26\",\r\n          \"api_name\":\"TestApi\",\r\n          \"versions\":[\"Default\"]\r\n        }\r\n      },\r\n      \"apply_policy_id\":\"5637cf893d24390001000005\",\r\n      \"tags\":[],\r\n      \"meta_data\":{},\r\n      \"basic_auth_data\":{},\r\n      \"org_id\": \"\"\r\n    }\r\n\r\nIt is created fine, and it works using it for the requests. But when I put it in the Dashboard > Keys > Lookup Keys, it doesn't find it. Is that expected?\r\n\r\nAlso, it seems that the only way to find activity by key, is through the Developers > View Key Data, because the keys in Activity By Key are different from the real keys. So when I create the keys directly from the Gateway API, I have no way to see activity by key. Is there a way to do this?\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/lonelycode/tyk/issues/comments/153992569","html_url":"https://github.com/lonelycode/tyk/issues/130#issuecomment-153992569","issue_url":"https://api.github.com/repos/lonelycode/tyk/issues/130","id":153992569,"user":{"login":"lonelycode","id":2444409,"avatar_url":"https://avatars.githubusercontent.com/u/2444409?v=3","gravatar_id":"","url":"https://api.github.com/users/lonelycode","html_url":"https://github.com/lonelycode","followers_url":"https://api.github.com/users/lonelycode/followers","following_url":"https://api.github.com/users/lonelycode/following{/other_user}","gists_url":"https://api.github.com/users/lonelycode/gists{/gist_id}","starred_url":"https://api.github.com/users/lonelycode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lonelycode/subscriptions","organizations_url":"https://api.github.com/users/lonelycode/orgs","repos_url":"https://api.github.com/users/lonelycode/repos","events_url":"https://api.github.com/users/lonelycode/events{/privacy}","received_events_url":"https://api.github.com/users/lonelycode/received_events","type":"User","site_admin":false},"created_at":"2015-11-05T08:55:45Z","updated_at":"2015-11-05T08:55:45Z","body":"That's probably happening because the key does not belong to an organisation, and when the dashboard was set up it was set up with a primary organisation. \r\n\r\nThe dashboard won't allow users of another organisations to pull tokens from a Tyk cluster if they key is not owned by the same organisation as that user.\r\n\r\nTo fix this, go to `Users -> Your User` in the dashboard\r\n\r\nAnd copy the `RPC ID` value, then use this value in the `org_id` element of your token, and `PUT` it to the gateway REST API, you will get a modified response and it should now be searchable in the dashboard.\r\n\r\nAs for the way key analytics hare handled, the keys that you see in the key analytics are the hashed representation of the token, once a token is created, it is only available to the user once, right after creation. After that it is hashed and can never be retrieved and is never stored alongside analytics, this is why we attach this representation to a developer profile so that there is some form of identity management in place.\r\n\r\nIf you want don't care about keeping the keys secured in Tyk, you can disable key hashing by setting `hash_keys` to `false` in both your `tyk.conf` and `tyk_analytics.conf` files.\r\n\r\nYou will need to recreate your keys through."}}