I'm a developer of a company's internal client system and there are some situations I have to login into the system using a user account to check for a bug or something. Since passwords are encrypted I can't just look up them in the DB and get the access.
The best thing I invented is to use a query parameter flag like ?heyThisIsAdmin=soJustLetMeInWithoutAnyPasswords which allows me to enter any password and log in.
But I quite understand the security concerns. Could you advise me some ways of achieving what I want but more robust and safe?
As you said, the solution you propose is not safe at all as any person reading the code or knowing the secret would use the magic query string to use this super power as well.
A better solution could be to create yourself an account on the client platform, but with a special flag on it allowing you to impersonate user accounts (or just see what they see). Such mechanism would require some development of course.
Please note that even with this solution the trick could only be done once your are already logged in. To increase security you could also require a 2nd factor for your authentication (email, SMS, TOTP...)
You need to see what you're trying to achieve here as a feature of your app, not a backdoor. You should be able to explain how it works to anyone without exposing your app. Because the strength of it is in: