arenanet / api-cdi

Collaborative Development Initiative for Public APIs
253 stars 41 forks source link

Missing "name" from /v2/tokeninfo #106

Closed darthmaim closed 8 years ago

darthmaim commented 8 years ago

I just ran into a weird bug with an API key a user tried to register in my app, turns out if you create/edit an API with an empty name, the "name" field is missing from /v2/tokeninfo. I think the endpoint used to return an empty string some time ago. Didn't expect the name to be missing and it broke my app.

Probably would be good to add validation to prevent users from creating new keys with empty names.

Example: https://api.guildwars2.com/v2/tokeninfo?access_token=9058814E-A18F-DD4C-BBD7-73DE23ECDB6FF2913C7C-0406-447C-B0FB-92FBE16ADD87

{
  "id": "9058814E-A18F-DD4C-BBD7-73DE23ECDB6F",
  "permissions": [
    "account"
  ]
}
lye commented 8 years ago

Bleh, that was my bad. The old account site enforced a non-empty name and the new one doesn't.

I'll change the new account site later this week to enforce the name, but in the meanwhile I'm going to push a fix live that forces these broken keys to have name: "". Sorry about that.

darthmaim commented 8 years ago

:+1:

lye commented 8 years ago

The workaround is live <3