mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
catches JSON.parse possible error in oauth2 identity token field (#4709)
This commit is contained in:
parent
7e209fa20a
commit
a5a1be23d6
@ -299,19 +299,22 @@ const renderIdentityTokenExpiry = (token?: Pick<OAuth2Token, 'identityToken'>) =
|
||||
return;
|
||||
}
|
||||
|
||||
const { exp } = JSON.parse(decodedString);
|
||||
|
||||
if (!exp) {
|
||||
return '(never expires)';
|
||||
try {
|
||||
const { exp } = JSON.parse(decodedString);
|
||||
if (!exp) {
|
||||
return '(never expires)';
|
||||
}
|
||||
const convertedExp = convertEpochToMilliseconds(exp);
|
||||
return (
|
||||
<span>
|
||||
(expires <TimeFromNow timestamp={convertedExp} />
|
||||
)
|
||||
</span>
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return '';
|
||||
}
|
||||
|
||||
const convertedExp = convertEpochToMilliseconds(exp);
|
||||
return (
|
||||
<span>
|
||||
(expires <TimeFromNow timestamp={convertedExp} />
|
||||
)
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
const renderAccessTokenExpiry = (token?: Pick<OAuth2Token, 'accessToken' | 'expiresAt'>) => {
|
||||
|
Loading…
Reference in New Issue
Block a user