Passing username and password in HTTP GET query parameters

Hexdigit _ picture Hexdigit _ · Apr 24, 2016 · Viewed 20.7k times · Source

I'm building a RESTful API for my application and I would like to make it as clean and transparent as possible.

I need to create an authentication endpoint and it makes most sense to me to build it so that users can authenticate in a following way:

GET https://example.com/
    auth?identity=<username_or_email>&password=<password>

As I said, passing the user auth data using HTTP GET method in query parameters just seems very clean to me.

But I would like you to ask about how secure it actually is. Considering it will be encrypted through SSL/TLS, do you think it's a good idea to transfer user credentials like this?

Answer

Set picture Set · Apr 25, 2016

As Display Name said, both variants are basically plain text (even using base64 encoding). So you must use TLS or another protection like HMAC

But from other side, Query string is less secure in terms of how Server/Client works with URLs in general. You can read about this here or here. Briefly you should be worry about the following

  • URLs are stored in web server logs
  • URLs are stored in the browser history
  • URLs are passed in Referrer headers