Fix getting badges by api when usekeys is true

Change-Id: Ie7479531aa7a47cc13b07d7524f80a9a5e2c3f9a
Merge "Fix getting badges by api when usekeys is true"