Imported Google Group message.
Date:Wednesday, 16 December 2015 14:10:46 UTC.
That’s quite weird:
It’s not a software bug, unless they are somehow being deleted - Tyk stores it’s OAuth clients in a set delimited by the organisation ID and as individual keys, so the set key looks something like this: oauth-data.2583f6ddd8c243b3664c8eb2bc0a3b2d.oauth-clientset.oauth-clientid.
Lets take a look at what’s in this set:
127.0.0.1:6379> SMEMBERS oauth-data.2583f6ddd8c243b3664c8eb2bc0a3b2d.oauth-clientset.oauth-clientid.
So, there’s our clients, all stored so you can list them in the dashboard
Let’s see if the set expires at all:
127.0.0.1:6379> TTL oauth-data.2583f6ddd8c243b3664c8eb2bc0a3b2d.oauth-clientset.oauth-clientid.
TTL of -1, great, it will live forever, or until the redis instance restarts
Now, this is a reference list of clients, lets check the individual keys to make sure they don’t expire, let’s take client 6d86abcef8c34f506987cb1d98531bf3:
127.0.0.1:6379> GET oauth-data.2583f6ddd8c243b3664c8eb2bc0a3b2d.oauth-clientid.6d86abcef8c34f506987cb1d98531bf3
Ok, now the TTL:
127.0.0.1:6379> TTL oauth-data.2583f6ddd8c243b3664c8eb2bc0a3b2d.oauth-clientid.6d86abcef8c34f506987cb1d98531bf3
Ok, so those won’t vanish either.
Now, let’s take a look at the deletion, the only way to delete a client is to call the DeleteClient call on our OAuth server storage interface, lets see where that gets used in the codebase:
Only two places where it gets mentioned, once in the storage handler, we can safely ignore that, and secondly in the API file, if you look at the relevant section, it’s just an API handler, so you can call it with the OAuth Tyk API, it doesn’t get invoked any other way.
The only way these get deleted is if you call the Tyk REST API with a delete call.
I’m really not sure how else to say that the software isn’t magicking away your OAuth clients except that maybe you have configured redis persistence wrongly, maybe take a look at the persistence docs, and in particularly appendonly
I’ve got a test running now just to make sure the entries above don’t magic away (that would be worrying) just to be thorough, but will need to wait a few days to see if it really is losing the data. In the meantime, I’d suggest looking at your redis config (maybe add a few test keys/values manually, then restart the instance to see if they still exist?)