balloman
balloman
Explore posts from servers
CC#
Created by balloman on 3/27/2023 in #help
❔ Audience is invalid error
I'm trying to use JWT authentication with .NET Core 7. I've created a jwt token, but when I try to use it for my server, I get the error: Bearer error="invalid_token", error_description="The audience 'backend' is invalid"
3 replies
CC#
Created by balloman on 2/11/2023 in #help
❔ Optional does not work with C# protobufs
I have a proto buf with the timestamp field being marked as optional, but it doesn't seem to do anything. I'm not sure if this is a bug or intended of the proto buf implementation. It's also not marked as nullable, so I have to do a null check to see if it exists, which feels very awkward.
2 replies
CC#
Created by balloman on 1/11/2023 in #help
✅ How Do I Save a New Fully Defined Relationship in EF Core?
Ok, so if I have a token which looks like this
/// <summary>
/// Represents a token for a device
/// </summary>
public class Token
{
/// <summary>
/// The actual token
/// </summary>
public required string TokenId { get; set; }
/// <summary>
/// The user the token belongs to
/// </summary>
public required User User { get; set; }
}
/// <summary>
/// Represents a token for a device
/// </summary>
public class Token
{
/// <summary>
/// The actual token
/// </summary>
public required string TokenId { get; set; }
/// <summary>
/// The user the token belongs to
/// </summary>
public required User User { get; set; }
}
and I have a user
public class User
{
public required string UserId { get; set; }
public required List<Token> Tokens { get; set; }
}
public class User
{
public required string UserId { get; set; }
public required List<Token> Tokens { get; set; }
}
How do I create a new token if the user doesn't exist?
16 replies