Hi @mc ,
When using JWT token authentication and validate the token, the server will get the token from the request header with the 'Authentication' key, after that validate it. If the token is valid, the user can continue accessing the resource, otherwise it will show the not permission notification message. You can refer to the following screenshot:
From your code, it seems that the access_token
(it is the JWT token, right?) is in the query string, right? Try to use F12 developer Network tool or Fiddler to check it. And then try to add the JWT token at the request header with the 'Authentication' key.
You can also refer to Brando's reply in this thread: add the custom middleware to add the JWT token at the request header:
app.Use(async (context, next) =>
{
var JWToken = context.Session.GetString("JWToken");
if (!string.IsNullOrEmpty(JWToken))
{
context.Request.Headers.Add("Authorization", "Bearer " + JWToken);
}
await next();
});
app.UseAuthentication();
app.UseAuthorization();
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion