Nabrok / gw2-discord-bot

Discord bot for the Guild Wars 2 API.
GNU General Public License v3.0
33 stars 25 forks source link

Not really an issue, cant find a better way to contact you #36

Closed noskillahh closed 5 years ago

noskillahh commented 5 years ago

Hi Nabrok,

sorry for bothering you. So when people change servers, the bot will see that their server was changed and update their server role accordingly. I was looking in the redis database, and to my surprise I could not find any full length API-keys anywhere in the db. How does the bot query API-keys? If I look up my own Discord ID in the db, the API-key I get in return cant be queried by me. Its not full length. Am I missing something here? Is it possible to find full length API-keys anywhere? Thanks in advance.

noskillahh commented 5 years ago

So as a total noob Ive been doing my best to make something out of the data in the redis db. I have found certain API-keys in full, in the form of gw2_discord:response_cache keys. These keys have a TTL and there do not seem to be response_cache keys for every user_token key. I am trying to query these API's to find out about certain guild memberships, to give you an idea of why I want to get the full API key.

Nabrok commented 5 years ago

Hi,

The users API keys should be stored in the hash gw2_discord:user_keys, with the users discord id as the key.

noskillahh commented 5 years ago

Hey Nabrok,

Thanks for the reply. I have found these keys, but the api key listed here isnt listed in full. It seems to only save (atleast how I can see it) the first three parts of the api key. I cant query any api key as it is saved in these keys in the db. Any idea?

Nabrok commented 5 years ago

That should be the full key. Are you viewing with the redis CLI?

hkeys gw2_discord:user_keys

To list available keys and then

hget gw2_discord:user_keys [ID]

To view one of them.

noskillahh commented 5 years ago

This is what I see in my redis:

hkeys gw2_discord:user_tokens [] hget gw2_discord:user_tokens 310166759854309398 (nil) get gw2_discord:user_tokens:310166759854309398 "{"id":"30D9D707-938C-BE4B-B1D5-E98F508D1849","name":"VF35G","permissions":["account"]}"

That key there in the end isnt the complete one. Im fucking it up?

Nabrok commented 5 years ago

user_keys, not user_tokens.

noskillahh commented 5 years ago

Thanks dude, got it like this. Sorry for bothering you.