title: Fetch access token from authorization header without bearer prefix
body: <p>I'm using the <strong>Microsoft.AspNetCore.Authentication.JwtBearer</strong> and <strong>System.IdentityModel.Tokens.Jwt</strong> packages for my .NET Core project.</p>
  <p>There are some controller endpoints protected by the <code>[Authorize]</code> annotation that have to fetch the access token from the request. Currently I'm fetching the access token in my controller method this way:</p>
  <pre><code>string accessTokenWithBearerPrefix = Request.Headers[HeaderNames.Authorization];
  string accessTokenWithoutBearerPrefix = accessTokenWithBearerPrefix.Substring(&quot;Bearer &quot;.Length);
  </code></pre>
  <p>and I would like to know if there is a better &quot;ready to use&quot; solution for this because using the code above might still lead to errors while taking the substring from the bearer token.</p>