-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The 'oi_act_lft' claim present in the specified principal is malformed or isn't of the expected type #15526
Comments
Sorry, this is my problem ~~ The code uses oi_act_lft |
@hyzx86 were you adding the |
Yes, there is. I made a custom UserClaimsProvider to automatically extend the validity of token after the user logs in. |
I deleted them for the time , but is there a better way to specify this expiration date? It's an hour now, and I hope it can be extended to one week. |
@kevinchalet , Thanks for your advice, the problem has been solved perfectly 👍 public class UserTokenLifeTimeClaimsProvider : IUserClaimsProvider
{
private readonly IHttpContextAccessor _httpContextAccessor;
public UserTokenLifeTimeClaimsProvider(IHttpContextAccessor httpContextAccessor)
{
_httpContextAccessor = httpContextAccessor;
}
public Task GenerateAsync(IUser user, ClaimsIdentity claims)
{
var lifeTime = TimeSpan.FromHours(10);
var request = _httpContextAccessor.HttpContext.Request;
if (request.Path.Value.ToLower().EndsWith("token") && request.Method.ToUpper() == "POST")
{
if (request.Form["rememberMe"] == "true")
{
lifeTime = TimeSpan.FromDays(7);
}
//claims.SetAccessTokenLifetime(lifeTime);
claims.SetRefreshTokenLifetime(lifeTime);
}
return Task.FromResult(claims);
}
} |
Describe the bug
To Reproduce
Steps to reproduce the behavior:
My application worked fine when using oc 1.8, but after upgrading to 1.9 preivew, the token api threw 500 error codes
OpenIdServerSettings
OpenId Application Settings
Expected behavior
Expect to get the Token correctly
Screenshots
Request:
Response:
Logs
The text was updated successfully, but these errors were encountered: