© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•14mo ago•
25 replies
Mohi

✅ jwt token

Hello guys, hopeyou are doing great in new year, I am new to dotnet, and actually facing a probelmregarding JWT token and appriciate any help:)
The point is, I'm using dotnet 8, and added the JWT using
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authentication.JwtBearer;
which works completely fine on dev environment, and I have set up the setting for it like this:
Logging": {
Logging": {

"LogLevel": {
"LogLevel": {

 "Default": "Information",
 "Default": "Information",

 "Microsoft.AspNetCore": "Warning"
 "Microsoft.AspNetCore": "Warning"

}
}

},
},

"AllowedHosts": "*",
"AllowedHosts": "*",

"CORS": {
"CORS": {

"AllowedOrigins": ["http://localhost:3000", "https://localhost:3000"]
"AllowedOrigins": ["http://localhost:3000", "https://localhost:3000"]

},
},

"JwtSettings": {
"JwtSettings": {

 "Issuer": "https://localhost:7217/api",
 "Issuer": "https://localhost:7217/api",

"Audience": "http://localhost:3000",
"Audience": "http://localhost:3000",

 "SecretKey": "***",
 "SecretKey": "***",

"ExpiresInMinutes": 1440
"ExpiresInMinutes": 1440

}
}


and Im using this tag to make them accessible via token
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
over ecah controller I need it. I'm using Azure for deploying for test env and I defined CROS policy, secret key and other suff like I did for dev, and it is working but for the endpoints I used that accesibilty tag I get CORS and 500 server error. although as I said, I already defined CORS policy and it is working for other endpoints andI tested a lot of things but none worked. Appriciate any idea and help 🥹 here is my config for test env:
{
"Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "CORS": {
    "AllowedOrigins": ["https://test-app.hitaxi.cab"]
  },
  "JwtSettings": {
    "Issuer": "https://test-api.hitaxi.cab/api",
    "Audience": "https://test-app.hitaxi.cab",
    "SecretKey": "**",
    "ExpiresInMinutes": 60
  }
}
{
"Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "CORS": {
    "AllowedOrigins": ["https://test-app.hitaxi.cab"]
  },
  "JwtSettings": {
    "Issuer": "https://test-api.hitaxi.cab/api",
    "Audience": "https://test-app.hitaxi.cab",
    "SecretKey": "**",
    "ExpiresInMinutes": 60
  }
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ JWT TOKEN
C#CC# / help
4y ago
JWT Token Error
C#CC# / help
11mo ago
✅ Refresh Token + JWT + Identity
C#CC# / help
2y ago
❔ JWT Refresh tokens
C#CC# / help
3y ago