Yasu
Yasu
CC#
Created by Yasu on 10/20/2024 in #help
Can anyone help me switch my primary key column from int to uniqueidentifier for my web app?
there is no code atm
7 replies
CC#
Created by Yasu on 10/18/2024 in #help
Why is my JWT token not getting authorized and not getting entering the [Authorize] method?
C#
private string GenerateJwtToken(LogInAndSignUp user)
{
var claims = new[]
{
new Claim(JwtRegisteredClaimNames.Sub, user.Email),
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString())
};

var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_config["JwtSettings:Key"]!)); // Use your static key
var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);

var token = new JwtSecurityToken(
issuer: _config["JwtSettings:Issuer"],
audience: _config["JwtSettings:Audience"],
claims: claims,
expires: DateTime.Now.AddMinutes(30), // Set token expiration time
signingCredentials: creds);

// Debug output to check the token
Console.WriteLine($"Generated Token: {new JwtSecurityTokenHandler().WriteToken(token)}");


return new JwtSecurityTokenHandler().WriteToken(token);
}
C#
private string GenerateJwtToken(LogInAndSignUp user)
{
var claims = new[]
{
new Claim(JwtRegisteredClaimNames.Sub, user.Email),
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString())
};

var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_config["JwtSettings:Key"]!)); // Use your static key
var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);

var token = new JwtSecurityToken(
issuer: _config["JwtSettings:Issuer"],
audience: _config["JwtSettings:Audience"],
claims: claims,
expires: DateTime.Now.AddMinutes(30), // Set token expiration time
signingCredentials: creds);

// Debug output to check the token
Console.WriteLine($"Generated Token: {new JwtSecurityTokenHandler().WriteToken(token)}");


return new JwtSecurityTokenHandler().WriteToken(token);
}
this is the GenerateJwtToken method used in login method btw
2 replies
CC#
Created by Yasu on 10/9/2024 in #help
✅ can somebody help me learn about smtp so i can make a email message sender please
ye i did try it was vage for be tbh i couldnt understand most of it
6 replies
CC#
Created by Yasu on 10/9/2024 in #help
✅ can somebody help me learn about smtp so i can make a email message sender please
tysm
6 replies