Open akema-trebla opened 2 weeks ago
Hi @akema-trebla,
Have a look at a video I created about AuthP's JWT Token With Refresh feature. This section of the video shows how you can log in via Swagger in example 2.
Hi @JonPSmith
Thanks for your resources and I've watched them and the video explains it as I expect it to work. ie. even after the token has expired, the refresh token can be used to generate a new token and refresh token.
However, that does not happen even in Example 2.
Here's the error from Example 2
Microsoft.IdentityModel.Tokens.SecurityTokenInvalidIssuerException: IDX10211: Unable to validate issuer. The 'issuer' parameter is null or whitespace
at Microsoft.IdentityModel.Tokens.Validators.ValidateIssuerAsync(String issuer, SecurityToken securityToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
at Microsoft.IdentityModel.Tokens.Validators.ValidateIssuer(String issuer, SecurityToken securityToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
at Microsoft.IdentityModel.Tokens.Validators.ValidateIssuer(String issuer, SecurityToken securityToken, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateIssuer(String issuer, JwtSecurityToken jwtToken, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateTokenPayload(JwtSecurityToken jwtToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateJWS(String token, TokenValidationParameters validationParameters, BaseConfiguration currentConfiguration, SecurityToken& signatureValidatedToken, ExceptionDispatchInfo& exceptionThrown)
--- End of stack trace from previous location ---
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, JwtSecurityToken outerToken, TokenValidationParameters validationParameters, SecurityToken& signatureValidatedToken)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
at AuthPermissions.AspNetCore.JwtTokenCode.TokenBuilder.GetPrincipalFromExpiredToken(String token) in /Users/akema_trebla/Downloads/AuthPermissions.AspNetCore-main 2/AuthPermissions.AspNetCore/JwtTokenCode/TokenBuilder.cs:line 203
at AuthPermissions.AspNetCore.JwtTokenCode.TokenBuilder.RefreshTokenUsingRefreshTokenAsync(TokenAndRefreshToken tokenAndRefresh) in /Users/akema_trebla/Downloads/AuthPermissions.AspNetCore-main 2/AuthPermissions.AspNetCore/JwtTokenCode/TokenBuilder.cs:line 93
at Example2.WebApiWithToken.IndividualAccounts.Controllers.AuthenticateController.RefreshAuthentication(TokenAndRefreshToken tokenAndRefresh) in /Users/akema_trebla/Downloads/AuthPermissions.AspNetCore-main 2/Example2.WebApiWithToken.IndividualAccounts/Controllers/AuthenticateController.cs:line 107
at lambda_method363(Closure, Object)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.
Does the token refresh only work before token expiry or does it still work after token expiry?
Also, I get the following error when I try to run Example 2 to verify the above:
Unable to validate issuer. The 'issuer' parameter is null or whitespace.
Any pointers? Thanks.