Using bearer auth token

I went this route in my Hangfire Authorize Attribute, since I passed my Bearer token via querystring to the entry /dashboard URL then I have middleware to add the bearer token to the Authorization header.

So the first entry into the Dashboard passes auth but the other dashboard resources fail auth because of no Authorization header being transient from the original request, but I noticed the referer header specifies the original URL with auth token query param…so I was able to get the access_token from the header and validate it for any dashboard resource call…now to work on the refreshing of the token.

CustomJwtSecurityTokenHandler is my implementation but you can just using the JwtSecurityTokenHandler

Update: Other links are broken (auth failing) because the referer changes when it comes from another page in Hangfire, so I’ll just store it as a cookie and read it from there that’s the plan. Using the cookie works perfect.

Also using jquery, after successful auth I loaded the dashboard via iframe so no point for back to site, and the jquery client can keep the token refresh via a timer after the JWT expires :slight_smile:

Good luck!