Search code examples
securityspring-securityaccess-token

Standard Token place - header or payload


I want to secure my application using access token while communicating to the server.I am using nginx server which logs all the headers which are present in the request. It is a security threat if we are logging the header. If somebody can access the logs file. They can easily manipulate the data. Then why people use token in header?

In this case can we consider payload as the right choice?

What is the best place(or standard way) to put access token : Header or in payload?

What are the pros and cons of both?


Solution

  • IMHO, it is mainly a matter of taste, and of tools you use for testing ...

    If you use elaborated tools, that allows you to set custom headers, header is nice, because it does not clutter the payload. But if you want to be able to test with a simple browser, if is easier to add a request parameter than a header ...

    You can even accept both, first looking in the header, and then in payload if you could not find the token in header.