How to properly use Bearer tokens?
<p>I'm making an authorization system in <code>PHP</code>, and I came across this Bearer scheme of passing JWT tokens, I read [RFC 6750][1]. I've got the following doubts:</p>
<ol>
<li>How is this improving the security?</li>
<li>The server responses the client with a JWT token in its body after a successful authorization and login, and now when the client makes another request, I am not clear how to actually do that, I want to send token from client in Authorization header in the request, so now should I just prefix &quot;Bearer&quot; to the token which I received in the previous response from the server and If yes, then server on receiving the Authorization header, should just split the string with space, and take the second value from the obtained array and then decode it? For example <code>Authorization: Bearer fdbghfbfgbjhg_something</code>, how is server supposed to handle this, <code>decodeFunc(explode(&quot; &quot;, $this-&gt;getRequest()-&gt;getHeader(&quot;Authorization&quot;))[1])</code>?
[1]: <a href="https://www.rfc-editor.org/rfc/rfc6750" rel="nofollow noreferrer">https://www.rfc-editor.org/rfc/rfc6750</a></li>
</ol>