Mohi
Mohi
CC#
Created by Mohi on 12/28/2024 in #help
✅ 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; which works completely fine on dev environment, and I have set up the setting for it like this: Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, "AllowedHosts": "*", "CORS": { "AllowedOrigins": ["http://localhost:3000", "https://localhost:3000"] }, "JwtSettings": { "Issuer": "https://localhost:7217/api", "Audience": "http://localhost:3000", "SecretKey": "***", "ExpiresInMinutes": 1440 } and Im using this tag to make them accessible via token[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 } }
26 replies