Fumtik
November 22, 2020, 4:15pm
1
Product: PowerShell Universal
Version: 1.5.0
Previously had PSU 1.4.6 installed (was installed automatically by the VS Code extension). Downloaded and ran the 1.5.0 MSI installer. Since then, the VS Code extension will not allow any config file changes and refreshing does not show any scripts, APIs, Dashboards, etc. (which is kind of the whole point of the extension). I’ve tried uninstalling/reinstalling the extension as well as PSU to no avail. Trying to open a file under “Configuration” gives the following error:
“Error running command powershell-universal.openConfigFile: undefined. This is likely caused by the extension that contributes powershell-universal.openConfigFile.”
adam
November 22, 2020, 4:22pm
2
Can you try to generate a new app token?
Generate it in the admin console.
Set it in the settings of the extension.
I just tried myself and was able to connect to a 1.5 instance and open config files.
Fumtik
November 22, 2020, 4:31pm
3
Generated a new app token and entered into the extension settings. Still the same error (tried before and after restarting VS Code). I even get an error message just by clicking the “Refresh” icon for the Configuration section of the extension “Failed to refresh configuration.”
adam
November 22, 2020, 4:33pm
4
I would suggest looking in the PowerShell Universal log in %ProgramData%\PowerShellUniversal. It seems that the web server is throwing an error.
Fumtik
November 22, 2020, 5:26pm
5
Error below is in that log file when trying to use the extension:
2020-11-22T10:23:31.4068628-07:00 0HM4EVU08I94S:00000001 [INF] Failed to validate the token. (616bef97)
Microsoft.IdentityModel.Tokens.SecurityTokenNoExpirationException: IDX10225: Lifetime validation failed. The token is missing an Expiration Time. Tokentype: 'System.IdentityModel.Tokens.Jwt.JwtSecurityToken'.
at Microsoft.IdentityModel.Tokens.Validators.ValidateLifetime(Nullable`1 notBefore, Nullable`1 expires, SecurityToken securityToken, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateLifetime(Nullable`1 notBefore, Nullable`1 expires, JwtSecurityToken jwtToken, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateTokenPayload(JwtSecurityToken jwtToken, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
2020-11-22T10:23:31.4068968-07:00 0HM4EVU08I94S:00000001 [INF] "Bearer" was not authenticated. Failure message: "IDX10225: Lifetime validation failed. The token is missing an Expiration Time. Tokentype: 'System.IdentityModel.Tokens.Jwt.JwtSecurityToken'." (48071232)
2020-11-22T10:23:31.4069133-07:00 0HM4EVU08I94S:00000001 [INF] Authorization failed. (b15dd539)
2020-11-22T10:23:31.4069359-07:00 0HM4EVU08I94S:00000001 [INF] AuthenticationScheme: "Cookies" was challenged. (d45f1f38)
2020-11-22T10:23:31.4069487-07:00 0HM4EVU08I94S:00000001 [INF] AuthenticationScheme: "Bearer" was challenged. (d45f1f38)
2020-11-22T10:23:31.4076728-07:00 0HM4EVU08I94S:00000001 [INF] "Bearer" was not authenticated. Failure message: "IDX10225: Lifetime validation failed. The token is missing an Expiration Time. Tokentype: 'System.IdentityModel.Tokens.Jwt.JwtSecurityToken'." (48071232)
2020-11-22T10:23:31.4076930-07:00 0HM4EVU08I94S:00000001 [INF] Authorization failed. (b15dd539)
2020-11-22T10:23:31.4077133-07:00 0HM4EVU08I94S:00000001 [INF] AuthenticationScheme: "Cookies" was challenged. (d45f1f38)
2020-11-22T10:23:31.4077250-07:00 0HM4EVU08I94S:00000001 [INF] AuthenticationScheme: "Bearer" was challenged. (d45f1f38)
2020-11-22T10:23:31.4077683-07:00 0HM4EVU08I94S:00000001 [INF] Request finished in 2.1545ms 401 (791a596a)
Newly created App Token this morning shows the below dates:
Created: Nov 22, 2020 9:28 AM
Expiration: Apr 8, 2048 9:28 AM
adam
November 23, 2020, 3:26pm
6
Sorry. I should have mentioned that we have an issue with tokens set to the Never lifetime. ASP.NET Core is rejecting them. Create a token with a lifetime of 1 year.
Fumtik
November 23, 2020, 4:20pm
7
1 year expiration on the App Token fixed the issue! Maybe gray out / remove the “Never” option if it’s known to be broken. Appreciate the help!
1 Like
adam
November 23, 2020, 4:24pm
8
That’s the plan. We were hoping to figure out a way around it but we will probably just remove it in 1.5.3.